Class: Defaulty::Domain

Inherits:
Object
  • Object
show all
Defined in:
lib/defaulty.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(h) ⇒ Domain

Returns a new instance of Domain.



26
27
28
29
30
31
32
# File 'lib/defaulty.rb', line 26

def initialize(h)
  raise "Domain needs to be initialized with a hash containing one key, the domain name" unless h.size == 1

  @name, data = h.first
  properties = data.delete('keys').map { |key, data| Property.new(key, data) } 
  @properties = Hash[ properties.map { |property| [property.name, property] } ]
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



24
25
26
# File 'lib/defaulty.rb', line 24

def name
  @name
end

#propertiesObject (readonly)

Returns the value of attribute properties.



24
25
26
# File 'lib/defaulty.rb', line 24

def properties
  @properties
end