Class: CopyTunerIncompatibleSearch::ReplaceCommand::Usage
- Inherits:
-
Object
- Object
- CopyTunerIncompatibleSearch::ReplaceCommand::Usage
- Defined in:
- lib/copy_tuner_incompatible_search/replace_command.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #dynamic? ⇒ Boolean
-
#initialize(type:, key:, file:, line:) ⇒ Usage
constructor
A new instance of Usage.
- #lazy? ⇒ Boolean
- #lazy_key ⇒ Object
- #line ⇒ Object
- #static? ⇒ Boolean
- #used? ⇒ Boolean
Constructor Details
#initialize(type:, key:, file:, line:) ⇒ Usage
Returns a new instance of Usage.
87 88 89 90 91 92 |
# File 'lib/copy_tuner_incompatible_search/replace_command.rb', line 87 def initialize(type:, key:, file:, line:) @type = type @key = key.to_s @file = file.to_s @line = line.to_s end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
85 86 87 |
# File 'lib/copy_tuner_incompatible_search/replace_command.rb', line 85 def file @file end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
85 86 87 |
# File 'lib/copy_tuner_incompatible_search/replace_command.rb', line 85 def key @key end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
85 86 87 |
# File 'lib/copy_tuner_incompatible_search/replace_command.rb', line 85 def type @type end |
Instance Method Details
#dynamic? ⇒ Boolean
102 103 104 |
# File 'lib/copy_tuner_incompatible_search/replace_command.rb', line 102 def dynamic? @type == 'dynamic' end |
#lazy? ⇒ Boolean
98 99 100 |
# File 'lib/copy_tuner_incompatible_search/replace_command.rb', line 98 def lazy? @type == 'lazy' end |
#lazy_key ⇒ Object
110 111 112 113 114 115 |
# File 'lib/copy_tuner_incompatible_search/replace_command.rb', line 110 def lazy_key return unless lazy? last_key = key.split('.').last ".#{last_key}" end |
#line ⇒ Object
117 118 119 120 121 |
# File 'lib/copy_tuner_incompatible_search/replace_command.rb', line 117 def line raise 'line is not set' if @line.empty? @line.to_i end |
#static? ⇒ Boolean
94 95 96 |
# File 'lib/copy_tuner_incompatible_search/replace_command.rb', line 94 def static? @type == 'static' end |
#used? ⇒ Boolean
106 107 108 |
# File 'lib/copy_tuner_incompatible_search/replace_command.rb', line 106 def used? !dynamic? && !@file.to_s.strip.empty? end |