Class: Ari::Generators::Property
- Inherits:
-
Object
- Object
- Ari::Generators::Property
- Defined in:
- lib/ari/generators/property.rb
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(name, specification) ⇒ Property
constructor
A new instance of Property.
- #is_a_list? ⇒ Boolean
- #name ⇒ Object
- #required? ⇒ Boolean
- #type ⇒ Object
Constructor Details
#initialize(name, specification) ⇒ Property
Returns a new instance of Property.
5 6 7 8 |
# File 'lib/ari/generators/property.rb', line 5 def initialize(name, specification) @name = name @specification = specification end |
Instance Method Details
#description ⇒ Object
30 31 32 |
# File 'lib/ari/generators/property.rb', line 30 def description @specification['description'] end |
#is_a_list? ⇒ Boolean
26 27 28 |
# File 'lib/ari/generators/property.rb', line 26 def is_a_list? @specification['type'].start_with?('List[') end |
#name ⇒ Object
10 11 12 |
# File 'lib/ari/generators/property.rb', line 10 def name @name end |
#required? ⇒ Boolean
14 15 16 |
# File 'lib/ari/generators/property.rb', line 14 def required? @specification['required'] end |
#type ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/ari/generators/property.rb', line 18 def type if is_a_list? @specification['type'][5..-2] else @specification['type'] == 'void' ? nil : @specification['type'] end end |