Class: ROM::FMP::Gateway
- Inherits:
-
Gateway
- Object
- Gateway
- ROM::FMP::Gateway
- Defined in:
- lib/rom/fmp/mini.rb,
lib/rom/fmp/gateway.rb,
lib/rom/fmp/micro02.rb,
lib/rom/fmp/micro01.rb
Instance Attribute Summary collapse
-
#database ⇒ Object
readonly
Returns the value of attribute database.
-
#datasets ⇒ Object
readonly
Returns the value of attribute datasets.
-
#sets ⇒ Object
readonly
Returns the value of attribute sets.
Instance Method Summary collapse
- #connect(*args) ⇒ Object
- #dataset(name) ⇒ Object (also: #[])
- #dataset?(name) ⇒ Boolean
-
#initialize(*options) ⇒ Gateway
constructor
A new instance of Gateway.
Constructor Details
#initialize(*options) ⇒ Gateway
Returns a new instance of Gateway.
22 23 24 25 26 27 |
# File 'lib/rom/fmp/mini.rb', line 22 def initialize(uri, = {}) puts "INITIALIZING GATEWAY WITH uri: #{uri} options: #{}" @connection = connect(uri, ) @sets = {} self end |
Instance Attribute Details
#database ⇒ Object (readonly)
Returns the value of attribute database.
8 9 10 |
# File 'lib/rom/fmp/gateway.rb', line 8 def database @database end |
#datasets ⇒ Object (readonly)
Returns the value of attribute datasets.
8 9 10 |
# File 'lib/rom/fmp/gateway.rb', line 8 def datasets @datasets end |
#sets ⇒ Object (readonly)
Returns the value of attribute sets.
20 21 22 |
# File 'lib/rom/fmp/mini.rb', line 20 def sets @sets end |
Instance Method Details
#connect(*args) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/rom/fmp/mini.rb', line 41 def connect(*args) = args.last.kind_of?(Hash) ? args.pop : Hash.new .merge! args.pop if args.last.kind_of?(Hash) case args[0] when Rfm::Database args[0] else #::Rfm::Database.new(uri[:database], *Array([uri.to_s, *args]).flatten) #Rfm.layout(storage_name, gateway.adapter.options.merge(FMRESULTSET_TEMPLATE).symbolize_keys) Rfm.database(*args, .to_h.merge(FMRESULTSET_TEMPLATE).to_h) end end |
#dataset(name) ⇒ Object Also known as: []
29 30 31 |
# File 'lib/rom/fmp/mini.rb', line 29 def dataset(name) sets[name] = Dataset.new(name, connection) end |
#dataset?(name) ⇒ Boolean
37 38 39 |
# File 'lib/rom/fmp/mini.rb', line 37 def dataset?(name) sets.key?(name) end |