Class: Ari::Generators::Property

Inherits:
Object
  • Object
show all
Defined in:
lib/ari/generators/property.rb

Instance Method Summary collapse

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

#descriptionObject



30
31
32
# File 'lib/ari/generators/property.rb', line 30

def description
  @specification['description']
end

#is_a_list?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/ari/generators/property.rb', line 26

def is_a_list?
  @specification['type'].start_with?('List[')
end

#nameObject



10
11
12
# File 'lib/ari/generators/property.rb', line 10

def name
  @name
end

#required?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/ari/generators/property.rb', line 14

def required?
  @specification['required']
end

#typeObject



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