Class: ROM::Redis::Dataset
- Inherits:
-
Object
- Object
- ROM::Redis::Dataset
- Defined in:
- lib/rom/redis/dataset.rb
Instance Attribute Summary collapse
-
#commands ⇒ Object
readonly
Returns the value of attribute commands.
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(connection, commands = []) ⇒ Dataset
constructor
A new instance of Dataset.
- #method_missing(command, *args) ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(connection, commands = []) ⇒ Dataset
Returns a new instance of Dataset.
6 7 8 9 |
# File 'lib/rom/redis/dataset.rb', line 6 def initialize(connection, commands = []) @connection = connection @commands = commands end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(command, *args) ⇒ Object
19 20 21 |
# File 'lib/rom/redis/dataset.rb', line 19 def method_missing(command, *args) self.class.new(connection, commands.clone.push([command, args])) end |
Instance Attribute Details
#commands ⇒ Object (readonly)
Returns the value of attribute commands.
4 5 6 |
# File 'lib/rom/redis/dataset.rb', line 4 def commands @commands end |
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
4 5 6 |
# File 'lib/rom/redis/dataset.rb', line 4 def connection @connection end |
Instance Method Details
#each(&block) ⇒ Object
15 16 17 |
# File 'lib/rom/redis/dataset.rb', line 15 def each(&block) view.each(&block) end |
#to_a ⇒ Object
11 12 13 |
# File 'lib/rom/redis/dataset.rb', line 11 def to_a view end |