Class: Defaulty::Domain
- Inherits:
-
Object
- Object
- Defaulty::Domain
- Defined in:
- lib/defaulty.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
Instance Method Summary collapse
-
#initialize(h) ⇒ Domain
constructor
A new instance of Domain.
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
#name ⇒ Object (readonly)
Returns the value of attribute name.
24 25 26 |
# File 'lib/defaulty.rb', line 24 def name @name end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
24 25 26 |
# File 'lib/defaulty.rb', line 24 def properties @properties end |