Class: Unit::Schema
- Inherits:
-
Object
- Object
- Unit::Schema
- Defined in:
- lib/unit-ruby/util/schema.rb
Defined Under Namespace
Classes: Attribute
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
- #add(name, type, readonly: false) ⇒ Object
- #contains?(name) ⇒ Boolean
-
#initialize ⇒ Schema
constructor
A new instance of Schema.
Constructor Details
#initialize ⇒ Schema
Returns a new instance of Schema.
5 6 7 |
# File 'lib/unit-ruby/util/schema.rb', line 5 def initialize @attributes = [] end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
16 17 18 |
# File 'lib/unit-ruby/util/schema.rb', line 16 def attributes @attributes end |
Instance Method Details
#add(name, type, readonly: false) ⇒ Object
13 14 15 |
# File 'lib/unit-ruby/util/schema.rb', line 13 def add(name, type, readonly: false) @attributes << Attribute.new(name, type, readonly) end |
#contains?(name) ⇒ Boolean
9 10 11 |
# File 'lib/unit-ruby/util/schema.rb', line 9 def contains?(name) attributes.map(&:name).include? name end |