Class: Tutor::Attributes::Blocks::Instance::Reader

Inherits:
Tutor::Attributes::Block show all
Defined in:
lib/tutor/attributes/blocks/instance/reader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, &block) ⇒ Reader

Returns a new instance of Reader.



5
6
7
8
9
10
11
12
# File 'lib/tutor/attributes/blocks/instance/reader.rb', line 5

def initialize(name, &block)
  self.tap do |block|
    @name = name
    super() do |object|
      object.instance_variable_get("@#{block.name.to_s}".to_sym)
    end
  end
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



3
4
5
# File 'lib/tutor/attributes/blocks/instance/reader.rb', line 3

def block
  @block
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/tutor/attributes/blocks/instance/reader.rb', line 3

def name
  @name
end