Class: Analytical::CommandStore

Inherits:
Object
  • Object
show all
Defined in:
lib/analytical/command_store.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(initial_list = nil) ⇒ CommandStore

Returns a new instance of CommandStore.



5
6
7
# File 'lib/analytical/command_store.rb', line 5

def initialize(initial_list=nil)
  @commands = initial_list || []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object

Pass any array methods on to the internal array



14
15
16
# File 'lib/analytical/command_store.rb', line 14

def method_missing(method, *args, &block)
  @commands.send(method, *args, &block)
end

Instance Attribute Details

#commandsObject

Returns the value of attribute commands.



3
4
5
# File 'lib/analytical/command_store.rb', line 3

def commands
  @commands
end

Instance Method Details

#flushObject



9
10
11
# File 'lib/analytical/command_store.rb', line 9

def flush
  @commands = []
end