Class: SeleniumRecord::ActionBuilder::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium_record/action_builder.rb

Overview

Class for building complex actions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Builder

Returns a new instance of Builder.



17
18
19
20
# File 'lib/selenium_record/action_builder.rb', line 17

def initialize(&block)
  @actions = []
  @blk = block
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



27
28
29
30
# File 'lib/selenium_record/action_builder.rb', line 27

def method_missing(method, *args)
  @actions << Action.new(method, *args)
  self
end

Instance Attribute Details

#actionsObject

Returns the value of attribute actions.



15
16
17
# File 'lib/selenium_record/action_builder.rb', line 15

def actions
  @actions
end

Instance Method Details

#performObject



22
23
24
25
# File 'lib/selenium_record/action_builder.rb', line 22

def perform
  @actions.each { |action| @blk.call(action.method, action.args) }
  @actions.freeze
end