Class: Ken::Attribute

Inherits:
Object show all
Defined in:
lib/ken/attribute.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, property) ⇒ Attribute

initializes a resource by json result



6
7
8
9
10
11
12
# File 'lib/ken/attribute.rb', line 6

def initialize(data, property)
  raise "error" unless data.kind_of?(Array)
  
  @data = data
  @property = property # belongs to a property
  self
end

Instance Attribute Details

#propertyObject (readonly)

Returns the value of attribute property.



3
4
5
# File 'lib/ken/attribute.rb', line 3

def property
  @property
end

Class Method Details

.create(data, property) ⇒ Object



14
15
16
# File 'lib/ken/attribute.rb', line 14

def self.create(data, property)
  Ken::Attribute.new(data, property)
end

Instance Method Details

#inspectObject



24
25
26
# File 'lib/ken/attribute.rb', line 24

def inspect
  result = "#<Attribute property=\"#{property.id || "nil"}\">"
end

#object_type?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/ken/attribute.rb', line 37

def object_type?
  @property.object_type?
end

#to_sObject



19
20
21
# File 'lib/ken/attribute.rb', line 19

def to_s
  subject.to_s
end

#unique?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/ken/attribute.rb', line 33

def unique?
  @property.unique?
end

#valuesObject

returns just the subject



29
30
31
# File 'lib/ken/attribute.rb', line 29

def values
  subject
end