Class: FreebaseImporters::Base
- Inherits:
-
Object
- Object
- FreebaseImporters::Base
show all
- Defined in:
- lib/freebase_importers/base.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(data) ⇒ Base
Returns a new instance of Base.
4
5
6
|
# File 'lib/freebase_importers/base.rb', line 4
def initialize(data)
@data = data
end
|
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
3
4
5
|
# File 'lib/freebase_importers/base.rb', line 3
def data
@data
end
|
Class Method Details
.add_method(name, proc) ⇒ Object
18
19
20
|
# File 'lib/freebase_importers/base.rb', line 18
def self.add_method(name, proc)
define_method(name, proc)
end
|
.add_to_mql(key, value = nil) ⇒ Object
14
15
16
|
# File 'lib/freebase_importers/base.rb', line 14
def self.add_to_mql(key, value = nil)
mql[key.to_s] = value
end
|
.map(target, value = nil) ⇒ Object
8
9
10
11
12
|
# File 'lib/freebase_importers/base.rb', line 8
def self.map(target, value = nil)
add_to_mql(target, value)
target_ending = target.to_s.split('/').last
add_method(target_ending, CommonAccessors.single(target))
end
|