Class: Sawyer::Actions

Inherits:
Object
  • Object
show all
Includes:
RawActions
Defined in:
lib/sawyer/actions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RawActions

#events, #logs

Constructor Details

#initialize(opts, action, args, logger) ⇒ Actions

Returns a new instance of Actions.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/sawyer/actions.rb', line 21

def initialize opts, action, args, logger
  environment = opts[:environment].to_sym
  from        = Chronic.parse(opts[:from])
  to          = Chronic.parse(opts[:to])

  @prefix = opts[:prefix]
  @limit  = opts[:limit]
  @action = action
  @args   = args
  @logger = logger
  @status = 0

  @elasticsearch = ENVIRONMENTS[environment.to_sym]

  @status = send action, from, to, args
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



19
20
21
# File 'lib/sawyer/actions.rb', line 19

def logger
  @logger
end

#statusObject (readonly)

Returns the value of attribute status.



19
20
21
# File 'lib/sawyer/actions.rb', line 19

def status
  @status
end