Class: Castor::Configuration::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/castor/configuration/node.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, block) ⇒ Node

Returns a new instance of Node.



4
5
6
7
8
# File 'lib/castor/configuration/node.rb', line 4

def initialize(name, block)
  @name = name
  instance_eval(&block)
  self.value = @default
end

Instance Method Details

#valueObject



16
17
18
# File 'lib/castor/configuration/node.rb', line 16

def value
  lazy? ? lazy_value : @value
end

#value=(new_value) ⇒ Object



10
11
12
13
14
# File 'lib/castor/configuration/node.rb', line 10

def value=(new_value)
  if validate!(new_value)
    @value = new_value
  end
end