Class: ActionFactory::Assignments::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/action_factory/assignments/attribute.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(block) ⇒ Attribute

Returns a new instance of Attribute.



8
9
10
# File 'lib/action_factory/assignments/attribute.rb', line 8

def initialize(block)
  @block = block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



6
7
8
# File 'lib/action_factory/assignments/attribute.rb', line 6

def block
  @block
end

Instance Method Details

#==(other) ⇒ Object



16
17
18
# File 'lib/action_factory/assignments/attribute.rb', line 16

def ==(other)
  other.is_a?(self.class) && other.block == @block
end

#compile(factory) ⇒ Object



12
13
14
# File 'lib/action_factory/assignments/attribute.rb', line 12

def compile(factory)
  factory.instance_exec(&@block)
end