Class: HTOTConv::Outline::Item
- Inherits:
-
Struct
- Object
- Struct
- HTOTConv::Outline::Item
- Defined in:
- lib/htot_conv/outline.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#level ⇒ Object
Returns the value of attribute level.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key
77 78 79 |
# File 'lib/htot_conv/outline.rb', line 77 def key @key end |
#level ⇒ Object
Returns the value of attribute level
77 78 79 |
# File 'lib/htot_conv/outline.rb', line 77 def level @level end |
#value ⇒ Object
Returns the value of attribute value
77 78 79 |
# File 'lib/htot_conv/outline.rb', line 77 def value @value end |
Instance Method Details
#valid? ⇒ Boolean
85 86 87 88 89 90 91 92 |
# File 'lib/htot_conv/outline.rb', line 85 def valid? begin validate true rescue ValidationError false end end |
#validate ⇒ Object
78 79 80 81 82 83 |
# File 'lib/htot_conv/outline.rb', line 78 def validate raise ValidationError, "item level for item \"#{key}\" must be an integer" unless self.level.kind_of?(Numeric) raise ValidationError, "item level for item \"#{key}\" must be positive" unless self.level > 0 raise ValidationError, "item level for item \"#{key}\" must be an integer" unless (self.level.to_i == self.level) raise ValidationError, "value for item \"#{key}\" must be an array" unless self.value.kind_of?(Array) end |