Class: Mushikago::Hanamgri::Field
- Inherits:
-
Struct
- Object
- Struct
- Mushikago::Hanamgri::Field
- Defined in:
- lib/mushikago/hanamgri/field.rb
Instance Attribute Summary collapse
-
#knowledge_name ⇒ Object
Returns the value of attribute knowledge_name.
-
#name ⇒ Object
Returns the value of attribute name.
-
#required ⇒ Object
Returns the value of attribute required.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
Instance Attribute Details
#knowledge_name ⇒ Object
Returns the value of attribute knowledge_name
5 6 7 |
# File 'lib/mushikago/hanamgri/field.rb', line 5 def knowledge_name @knowledge_name end |
#name ⇒ Object
Returns the value of attribute name
5 6 7 |
# File 'lib/mushikago/hanamgri/field.rb', line 5 def name @name end |
#required ⇒ Object
Returns the value of attribute required
5 6 7 |
# File 'lib/mushikago/hanamgri/field.rb', line 5 def required @required end |
#type ⇒ Object
Returns the value of attribute type
5 6 7 |
# File 'lib/mushikago/hanamgri/field.rb', line 5 def type @type end |
Instance Method Details
#required? ⇒ Boolean
10 11 12 |
# File 'lib/mushikago/hanamgri/field.rb', line 10 def required? !!required end |
#to_json(*args) ⇒ Object
14 15 16 |
# File 'lib/mushikago/hanamgri/field.rb', line 14 def to_json *args {:name => name.to_s, :required => required?, :type => type, :knowledge_name => knowledge_name}.to_json(args) end |
#validate! ⇒ Object
6 7 8 |
# File 'lib/mushikago/hanamgri/field.rb', line 6 def validate! raise "Invalid Type Value [#{type}]" unless [:string, :number].include?(type) end |