Class: Kilza::Property
- Inherits:
-
Object
- Object
- Kilza::Property
- Defined in:
- lib/kilza/property.rb
Instance Attribute Summary collapse
-
#is_array ⇒ Object
Returns the value of attribute is_array.
-
#is_key ⇒ Object
Returns the value of attribute is_key.
-
#name ⇒ Object
Returns the value of attribute name.
-
#original_name ⇒ Object
Returns the value of attribute original_name.
-
#params ⇒ Object
Returns the value of attribute params.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(name, type, is_array, is_key) ⇒ Property
constructor
A new instance of Property.
- #is_array? ⇒ Boolean
- #is_boolean? ⇒ Boolean
- #is_fixnum? ⇒ Boolean
- #is_float? ⇒ Boolean
- #is_nil? ⇒ Boolean
- #is_object? ⇒ Boolean
- #to_hash ⇒ Object
Constructor Details
#initialize(name, type, is_array, is_key) ⇒ Property
Returns a new instance of Property.
10 11 12 13 14 15 16 |
# File 'lib/kilza/property.rb', line 10 def initialize(name, type, is_array, is_key) @name = Kilza::normalize(name) @original_name = name @type = type @is_array = is_array @is_key = is_key end |
Instance Attribute Details
#is_array ⇒ Object
Returns the value of attribute is_array.
7 8 9 |
# File 'lib/kilza/property.rb', line 7 def is_array @is_array end |
#is_key ⇒ Object
Returns the value of attribute is_key.
8 9 10 |
# File 'lib/kilza/property.rb', line 8 def is_key @is_key end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/kilza/property.rb', line 3 def name @name end |
#original_name ⇒ Object
Returns the value of attribute original_name.
4 5 6 |
# File 'lib/kilza/property.rb', line 4 def original_name @original_name end |
#params ⇒ Object
Returns the value of attribute params.
6 7 8 |
# File 'lib/kilza/property.rb', line 6 def params @params end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/kilza/property.rb', line 5 def type @type end |
Instance Method Details
#is_array? ⇒ Boolean
18 19 20 |
# File 'lib/kilza/property.rb', line 18 def is_array? @is_array end |
#is_boolean? ⇒ Boolean
30 31 32 |
# File 'lib/kilza/property.rb', line 30 def is_boolean? @type == 'trueclass' or @type == 'falseclass' end |
#is_fixnum? ⇒ Boolean
26 27 28 |
# File 'lib/kilza/property.rb', line 26 def is_fixnum? @type == 'fixnum' end |
#is_float? ⇒ Boolean
34 35 36 |
# File 'lib/kilza/property.rb', line 34 def is_float? @type == 'float' end |
#is_nil? ⇒ Boolean
38 39 40 |
# File 'lib/kilza/property.rb', line 38 def is_nil? @type == 'nilclass' end |
#is_object? ⇒ Boolean
22 23 24 |
# File 'lib/kilza/property.rb', line 22 def is_object? @type == 'object' or @type == @name.capitalize end |
#to_hash ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/kilza/property.rb', line 42 def to_hash hash = { :name => @name, :original_name => @original_name, :type => @type, :params => @params, :is_array? => @is_array, :is_object? => is_object?, :is_fixnum? => is_fixnum?, :is_boolean? => is_boolean?, :is_float? => is_float?, :is_nil? => is_nil? } hash end |