Class: FreebaseAPI::Attribute

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

Overview

Attribute can be any Freebase data type

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, options = {}) ⇒ Attribute

Returns a new instance of Attribute.



7
8
9
10
# File 'lib/freebase_api/attribute.rb', line 7

def initialize(data, options={})
  @data = data
  @type = options[:type]
end

Instance Attribute Details

#typeObject

Returns the value of attribute type.



5
6
7
# File 'lib/freebase_api/attribute.rb', line 5

def type
  @type
end

Instance Method Details

#inspectObject



28
29
30
# File 'lib/freebase_api/attribute.rb', line 28

def inspect
  "#<#{self.class}:0x#{self.__id__.to_s(16)} value: \"#{self.value}\", type: \"#{self.type}\">"
end

#langObject



20
21
22
# File 'lib/freebase_api/attribute.rb', line 20

def lang
  @data['lang']
end

#textObject



16
17
18
# File 'lib/freebase_api/attribute.rb', line 16

def text
  @data['text']
end

#valueObject



12
13
14
# File 'lib/freebase_api/attribute.rb', line 12

def value
  @data['value']
end