Class: ROM::Redis::Dataset

Inherits:
Object
  • Object
show all
Defined in:
lib/rom/redis/dataset.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#commandsObject (readonly)

Returns the value of attribute commands.



4
5
6
# File 'lib/rom/redis/dataset.rb', line 4

def commands
  @commands
end

#connectionObject (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_aObject



11
12
13
# File 'lib/rom/redis/dataset.rb', line 11

def to_a
  view
end