Module: Bmg::Factory
Instance Method Summary collapse
- #csv(path, options = {}, type = Type::ANY) ⇒ Object
- #empty(type = Type::ANY) ⇒ Object
- #excel(*args, &bl) ⇒ Object
- #excel_file(path, options = {}, type = Type::ANY) ⇒ Object
- #generate(from, to, options = {}) ⇒ Object
- #in_memory(enumerable, type = Type::ANY) ⇒ Object
- #json(*args, &bl) ⇒ Object
- #json_file(path, options = {}, type = Type::ANY) ⇒ Object
- #mutable(enumerable, type = Type::ANY) ⇒ Object
- #text_file(path, options = {}, type = Type::ANY) ⇒ Object
- #yaml(*args, &bl) ⇒ Object
- #yaml_file(path, options = {}, type = Type::ANY) ⇒ Object
Instance Method Details
#csv(path, options = {}, type = Type::ANY) ⇒ Object
25 26 27 |
# File 'lib/bmg/support/factory.rb', line 25 def csv(path, = {}, type = Type::ANY) Reader::Csv.new(type, path, ).spied(Bmg.main_spy) end |
#empty(type = Type::ANY) ⇒ Object
3 4 5 6 |
# File 'lib/bmg/support/factory.rb', line 3 def empty(type = Type::ANY) raise ArgumentError, "Missing type" if type.nil? Relation::Empty.new(type) end |
#excel(*args, &bl) ⇒ Object
49 50 51 |
# File 'lib/bmg/support/factory.rb', line 49 def excel(*args, &bl) excel_file(*args, &bl) end |
#excel_file(path, options = {}, type = Type::ANY) ⇒ Object
45 46 47 |
# File 'lib/bmg/support/factory.rb', line 45 def excel_file(path, = {}, type = Type::ANY) Reader::Excel.new(type, path, ).spied(Bmg.main_spy) end |
#generate(from, to, options = {}) ⇒ Object
16 17 18 19 |
# File 'lib/bmg/support/factory.rb', line 16 def generate(from, to, = {}) type = Type::ANY.with_attrlist([[:as] || Operator::Generator::DEFAULT_OPTIONS[:as]]) Operator::Generator.new(type, from, to, ) end |
#in_memory(enumerable, type = Type::ANY) ⇒ Object
12 13 14 |
# File 'lib/bmg/support/factory.rb', line 12 def in_memory(enumerable, type = Type::ANY) Relation::InMemory.new(type, enumerable).spied(Bmg.main_spy) end |
#json(*args, &bl) ⇒ Object
33 34 35 |
# File 'lib/bmg/support/factory.rb', line 33 def json(*args, &bl) json_file(*args, &bl) end |
#json_file(path, options = {}, type = Type::ANY) ⇒ Object
29 30 31 |
# File 'lib/bmg/support/factory.rb', line 29 def json_file(path, = {}, type = Type::ANY) in_memory(path.load.map{|tuple| TupleAlgebra.symbolize_keys(tuple) }) end |
#mutable(enumerable, type = Type::ANY) ⇒ Object
8 9 10 |
# File 'lib/bmg/support/factory.rb', line 8 def mutable(enumerable, type = Type::ANY) Relation::InMemory::Mutable.new(type, enumerable).spied(Bmg.main_spy) end |
#text_file(path, options = {}, type = Type::ANY) ⇒ Object
21 22 23 |
# File 'lib/bmg/support/factory.rb', line 21 def text_file(path, = {}, type = Type::ANY) Reader::TextFile.new(type, path, ).spied(Bmg.main_spy) end |
#yaml(*args, &bl) ⇒ Object
41 42 43 |
# File 'lib/bmg/support/factory.rb', line 41 def yaml(*args, &bl) yaml_file(*args, &bl) end |
#yaml_file(path, options = {}, type = Type::ANY) ⇒ Object
37 38 39 |
# File 'lib/bmg/support/factory.rb', line 37 def yaml_file(path, = {}, type = Type::ANY) in_memory(path.load.map{|tuple| TupleAlgebra.symbolize_keys(tuple) }) end |