Class: SuperDiff::Operations::UnaryOperation
- Inherits:
-
Object
- Object
- SuperDiff::Operations::UnaryOperation
- Defined in:
- lib/super_diff/operations/unary_operation.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(name:, collection:, key:, value:, index:, index_in_collection: index) ⇒ UnaryOperation
constructor
A new instance of UnaryOperation.
- #should_add_comma_after_displaying? ⇒ Boolean
Constructor Details
#initialize(name:, collection:, key:, value:, index:, index_in_collection: index) ⇒ UnaryOperation
Returns a new instance of UnaryOperation.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/super_diff/operations/unary_operation.rb', line 14 def initialize( name:, collection:, key:, value:, # TODO: Is this even used?? index:, index_in_collection: index ) @name = name @collection = collection @key = key @value = value # TODO: Is this even used?? @index = index @index_in_collection = index_in_collection end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
4 5 6 |
# File 'lib/super_diff/operations/unary_operation.rb', line 4 def collection @collection end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
4 5 6 |
# File 'lib/super_diff/operations/unary_operation.rb', line 4 def index @index end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
4 5 6 |
# File 'lib/super_diff/operations/unary_operation.rb', line 4 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/super_diff/operations/unary_operation.rb', line 4 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/super_diff/operations/unary_operation.rb', line 4 def value @value end |
Instance Method Details
#should_add_comma_after_displaying? ⇒ Boolean
32 33 34 |
# File 'lib/super_diff/operations/unary_operation.rb', line 32 def index_in_collection < collection.size - 1 end |