Class: Jasonette::Properties::PropertyEnum

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/jasonette/core/properties.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(properties = {}) ⇒ PropertyEnum

Returns a new instance of PropertyEnum.



9
10
11
# File 'lib/jasonette/core/properties.rb', line 9

def initialize properties = {}
  @properties = properties
end

Instance Attribute Details

#propertiesObject

Returns the value of attribute properties.



7
8
9
# File 'lib/jasonette/core/properties.rb', line 7

def properties
  @properties
end

Instance Method Details

#has_type?(name, ptype) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/jasonette/core/properties.rb', line 21

def has_type?(name, ptype)
  value[name.to_sym][ptype.to_sym] rescue false
end

#merge!(value) ⇒ Object



13
14
15
16
# File 'lib/jasonette/core/properties.rb', line 13

def merge! value
  properties.merge! value if value.is_a? Hash
  properties.merge! value.properties if value.is_a? self.class
end

#namesObject



18
# File 'lib/jasonette/core/properties.rb', line 18

def names; properties.keys end

#valueObject



19
# File 'lib/jasonette/core/properties.rb', line 19

def value; properties end