Class: FunFX::Meta::Property
- Inherits:
-
Object
- Object
- FunFX::Meta::Property
- Defined in:
- lib/funfx/meta/parser.rb
Instance Method Summary collapse
- #default_value ⇒ Object
-
#initialize(property, param) ⇒ Property
constructor
A new instance of Property.
- #name ⇒ Object
- #ruby_name ⇒ Object
- #ruby_type ⇒ Object
- #to_arg ⇒ Object
- #to_dot ⇒ Object
Constructor Details
#initialize(property, param) ⇒ Property
Returns a new instance of Property.
119 120 121 |
# File 'lib/funfx/meta/parser.rb', line 119 def initialize(property, param) @property, @param = property, param end |
Instance Method Details
#default_value ⇒ Object
140 141 142 143 144 |
# File 'lib/funfx/meta/parser.rb', line 140 def default_value default = @property['DefaultValue'] return nil if default.nil? ruby_type.from_funfx_string(default) end |
#name ⇒ Object
123 124 125 |
# File 'lib/funfx/meta/parser.rb', line 123 def name @property['Name'] end |
#ruby_name ⇒ Object
127 128 129 130 131 132 133 |
# File 'lib/funfx/meta/parser.rb', line 127 def ruby_name if @param name.underscore else name.underscore + (ruby_type == TrueClass ? '?' : '') end end |
#ruby_type ⇒ Object
135 136 137 138 |
# File 'lib/funfx/meta/parser.rb', line 135 def ruby_type type = @property.find('PropertyType').first['Type'].underscore.to_sym Decoder.convert_type(type) end |
#to_arg ⇒ Object
150 151 152 |
# File 'lib/funfx/meta/parser.rb', line 150 def to_arg (default_value ? "#{ruby_name}=#{default_value.inspect}" : ruby_name) end |
#to_dot ⇒ Object
146 147 148 |
# File 'lib/funfx/meta/parser.rb', line 146 def to_dot "#{ruby_name} : #{ruby_type.name}" end |