Class: Droonga::SingleStepDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/droonga/single_step_definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(plugin_module) {|_self| ... } ⇒ SingleStepDefinition

Returns a new instance of SingleStepDefinition.

Yields:

  • (_self)

Yield Parameters:



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/droonga/single_step_definition.rb', line 26

def initialize(plugin_module)
  @plugin_module = plugin_module
  @name = nil
  @handler = nil
  @collector = nil
  @write = false
  @single_operation = false
  @use_all_replicas = false
  @timeout_calculator = lambda do |step|
    if step["timeout"]
      return step["timeout"]
    elsif step["body"]
      return step["body"]["timeout"] if step["body"]["timeout"]
    end
    nil
  end

  @inputs = []
  @output = {}
  yield(self)
end

Instance Attribute Details

#collectorObject

Returns the value of attribute collector.



20
21
22
# File 'lib/droonga/single_step_definition.rb', line 20

def collector
  @collector
end

#handlerObject

Returns the value of attribute handler.



19
20
21
# File 'lib/droonga/single_step_definition.rb', line 19

def handler
  @handler
end

#inputsObject

Returns the value of attribute inputs.



24
25
26
# File 'lib/droonga/single_step_definition.rb', line 24

def inputs
  @inputs
end

#nameObject

Returns the value of attribute name.



18
19
20
# File 'lib/droonga/single_step_definition.rb', line 18

def name
  @name
end

#outputObject

Returns the value of attribute output.



25
26
27
# File 'lib/droonga/single_step_definition.rb', line 25

def output
  @output
end

#single_operation=(value) ⇒ Object (writeonly)

Sets the attribute single_operation

Parameters:

  • value

    the value to set the attribute single_operation to.



21
22
23
# File 'lib/droonga/single_step_definition.rb', line 21

def single_operation=(value)
  @single_operation = value
end

#timeout_calculator=(value) ⇒ Object (writeonly)

Sets the attribute timeout_calculator

Parameters:

  • value

    the value to set the attribute timeout_calculator to.



23
24
25
# File 'lib/droonga/single_step_definition.rb', line 23

def timeout_calculator=(value)
  @timeout_calculator = value
end

#use_all_replicas=(value) ⇒ Object (writeonly)

Sets the attribute use_all_replicas

Parameters:

  • value

    the value to set the attribute use_all_replicas to.



22
23
24
# File 'lib/droonga/single_step_definition.rb', line 22

def use_all_replicas=(value)
  @use_all_replicas = value
end

#write=(value) ⇒ Object (writeonly)

Sets the attribute write

Parameters:

  • value

    the value to set the attribute write to.



21
22
23
# File 'lib/droonga/single_step_definition.rb', line 21

def write=(value)
  @write = value
end

Instance Method Details

#collector_classObject



74
75
76
# File 'lib/droonga/single_step_definition.rb', line 74

def collector_class
  resolve_class(@collector)
end

#handler_classObject



70
71
72
# File 'lib/droonga/single_step_definition.rb', line 70

def handler_class
  resolve_class(@handler)
end

#single_operation?Boolean

Returns:

  • (Boolean)


52
53
54
55
# File 'lib/droonga/single_step_definition.rb', line 52

def single_operation?
  return false if @write
  @single_operation
end

#timeout_for_step(step) ⇒ Object



62
63
64
65
66
67
68
# File 'lib/droonga/single_step_definition.rb', line 62

def timeout_for_step(step)
  if @timeout_calculator
    @timeout_calculator.call(step)
  else
    nil
  end
end

#use_all_replicas?Boolean

Returns:

  • (Boolean)


57
58
59
60
# File 'lib/droonga/single_step_definition.rb', line 57

def use_all_replicas?
  return true if @write
  @use_all_replicas
end

#write?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/droonga/single_step_definition.rb', line 48

def write?
  @write
end