Class: Balboa::Interactor::CapybaraInteractor
- Inherits:
-
Object
- Object
- Balboa::Interactor::CapybaraInteractor
- Defined in:
- lib/balboa/interactor/capybara_interactor.rb
Constant Summary collapse
- CommandNotFound =
Class.new(RuntimeError)
- LoginCommandNotFound =
Class.new(RuntimeError)
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #add_command(key, command) ⇒ Object
-
#initialize(options = {}) ⇒ CapybaraInteractor
constructor
A new instance of CapybaraInteractor.
- #last ⇒ Object
- #punch(date) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ CapybaraInteractor
Returns a new instance of CapybaraInteractor.
13 14 15 16 17 |
# File 'lib/balboa/interactor/capybara_interactor.rb', line 13 def initialize(={}) @options = @commands = Hash.new { fail CommandNotFound } @signed_in = false end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
11 12 13 |
# File 'lib/balboa/interactor/capybara_interactor.rb', line 11 def @options end |
Instance Method Details
#add_command(key, command) ⇒ Object
19 20 21 |
# File 'lib/balboa/interactor/capybara_interactor.rb', line 19 def add_command(key, command) @commands[key.to_s] = command end |
#last ⇒ Object
23 24 25 26 |
# File 'lib/balboa/interactor/capybara_interactor.rb', line 23 def last login unless signed_in? @commands['last'].execute end |
#punch(date) ⇒ Object
28 29 30 31 |
# File 'lib/balboa/interactor/capybara_interactor.rb', line 28 def punch(date) login unless signed_in? @commands['punch'].execute(date) end |