Class: QuerySet
- Inherits:
-
Object
- Object
- QuerySet
- Defined in:
- lib/query_set.rb
Defined Under Namespace
Classes: Query
Constant Summary collapse
- VERSION =
'0.0.0'
Instance Attribute Summary collapse
-
#conn ⇒ Object
Returns the value of attribute conn.
-
#path ⇒ Object
Returns the value of attribute path.
-
#query ⇒ Object
Returns the value of attribute query.
-
#store ⇒ Object
Returns the value of attribute store.
Instance Method Summary collapse
- #[](file_name) ⇒ Object
- #[]=(key, value) ⇒ Object
- #execute(file_name, *args) ⇒ Object
-
#initialize(conn, path, query: Query, store: {}) ⇒ QuerySet
constructor
A new instance of QuerySet.
Constructor Details
Instance Attribute Details
#conn ⇒ Object
Returns the value of attribute conn.
4 5 6 |
# File 'lib/query_set.rb', line 4 def conn @conn end |
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/query_set.rb', line 4 def path @path end |
#query ⇒ Object
Returns the value of attribute query.
4 5 6 |
# File 'lib/query_set.rb', line 4 def query @query end |
#store ⇒ Object
Returns the value of attribute store.
4 5 6 |
# File 'lib/query_set.rb', line 4 def store @store end |
Instance Method Details
#[](file_name) ⇒ Object
13 14 15 16 17 |
# File 'lib/query_set.rb', line 13 def [](file_name) store.fetch(file_name) do store[file_name] = query.new(File.read(path % file_name)) end end |
#[]=(key, value) ⇒ Object
19 20 21 |
# File 'lib/query_set.rb', line 19 def []=(key, value) store[key] = value end |
#execute(file_name, *args) ⇒ Object
23 24 25 |
# File 'lib/query_set.rb', line 23 def execute(file_name, *args) self.[](file_name).execute(conn, *args) end |