Class: SuperDiff::Operations::UnaryOperation

Inherits:
Object
  • Object
show all
Defined in:
lib/super_diff/operations/unary_operation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, collection:, key:, value:, index:) ⇒ UnaryOperation

Returns a new instance of UnaryOperation.



12
13
14
15
16
17
18
# File 'lib/super_diff/operations/unary_operation.rb', line 12

def initialize(name:, collection:, key:, value:, index:)
  @name = name
  @collection = collection
  @key = key
  @value = value
  @index = index
end

Instance Attribute Details

#collectionObject (readonly)

Returns the value of attribute collection.



4
5
6
# File 'lib/super_diff/operations/unary_operation.rb', line 4

def collection
  @collection
end

#keyObject (readonly)

Returns the value of attribute key.



4
5
6
# File 'lib/super_diff/operations/unary_operation.rb', line 4

def key
  @key
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/super_diff/operations/unary_operation.rb', line 4

def name
  @name
end

#valueObject (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

Returns:

  • (Boolean)


20
21
22
# File 'lib/super_diff/operations/unary_operation.rb', line 20

def should_add_comma_after_displaying?
  index < collection.size - 1
end