Class: HCast::Metadata::Attribute
- Inherits:
-
Object
- Object
- HCast::Metadata::Attribute
- Defined in:
- lib/hcast/metadata/attribute.rb
Instance Attribute Summary collapse
-
#caster ⇒ Object
readonly
Returns the value of attribute caster.
-
#children ⇒ Object
Returns the value of attribute children.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #allow_nil? ⇒ Boolean
- #has_children? ⇒ Boolean
-
#initialize(name, caster, options) ⇒ Attribute
constructor
A new instance of Attribute.
- #optional? ⇒ Boolean
- #required? ⇒ Boolean
Constructor Details
#initialize(name, caster, options) ⇒ Attribute
Returns a new instance of Attribute.
6 7 8 9 10 11 |
# File 'lib/hcast/metadata/attribute.rb', line 6 def initialize(name, caster, ) @name = name @caster = caster @options = @children = [] end |
Instance Attribute Details
#caster ⇒ Object (readonly)
Returns the value of attribute caster.
3 4 5 |
# File 'lib/hcast/metadata/attribute.rb', line 3 def caster @caster end |
#children ⇒ Object
Returns the value of attribute children.
4 5 6 |
# File 'lib/hcast/metadata/attribute.rb', line 4 def children @children end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/hcast/metadata/attribute.rb', line 3 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/hcast/metadata/attribute.rb', line 3 def @options end |
Instance Method Details
#allow_nil? ⇒ Boolean
25 26 27 |
# File 'lib/hcast/metadata/attribute.rb', line 25 def allow_nil? !![:allow_nil] end |
#has_children? ⇒ Boolean
13 14 15 |
# File 'lib/hcast/metadata/attribute.rb', line 13 def has_children? !children.empty? end |
#optional? ⇒ Boolean
21 22 23 |
# File 'lib/hcast/metadata/attribute.rb', line 21 def optional? !![:optional] end |
#required? ⇒ Boolean
17 18 19 |
# File 'lib/hcast/metadata/attribute.rb', line 17 def required? !optional? end |