Class: Ninetails::PropertyType

Inherits:
Object
  • Object
show all
Defined in:
app/components/ninetails/property_type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type) ⇒ PropertyType

Returns a new instance of PropertyType.



5
6
7
8
9
# File 'app/components/ninetails/property_type.rb', line 5

def initialize(name, type)
  @name = name
  @type = type
  @property = type.new
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



3
4
5
# File 'app/components/ninetails/property_type.rb', line 3

def name
  @name
end

#propertyObject

Returns the value of attribute property.



3
4
5
# File 'app/components/ninetails/property_type.rb', line 3

def property
  @property
end

#serialized_valuesObject

Returns the value of attribute serialized_values.



3
4
5
# File 'app/components/ninetails/property_type.rb', line 3

def serialized_values
  @serialized_values
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'app/components/ninetails/property_type.rb', line 3

def type
  @type
end

Instance Method Details

#serializeObject



16
17
18
19
20
21
22
# File 'app/components/ninetails/property_type.rb', line 16

def serialize
  if serialized_values.present?
    serialized_values
  elsif type.respond_to? :serialize
    type.serialize
  end
end