Class: Ken::Attribute
Instance Attribute Summary collapse
-
#property ⇒ Object
readonly
Returns the value of attribute property.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data, property) ⇒ Attribute
constructor
initializes a resource by json result.
- #inspect ⇒ Object
- #object_type? ⇒ Boolean
- #to_s ⇒ Object
- #unique? ⇒ Boolean
-
#values ⇒ Object
returns just the subject.
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
#property ⇒ Object (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
#inspect ⇒ Object
24 25 26 |
# File 'lib/ken/attribute.rb', line 24 def inspect result = "#<Attribute property=\"#{property.id || "nil"}\">" end |
#object_type? ⇒ Boolean
37 38 39 |
# File 'lib/ken/attribute.rb', line 37 def object_type? @property.object_type? end |
#unique? ⇒ Boolean
33 34 35 |
# File 'lib/ken/attribute.rb', line 33 def unique? @property.unique? end |
#values ⇒ Object
returns just the subject
29 30 31 |
# File 'lib/ken/attribute.rb', line 29 def values subject end |