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.
12 13 14 15 16 |
# File 'lib/balboa/interactor/capybara_interactor.rb', line 12 def initialize( = {}) @options = @commands = Hash.new { raise CommandNotFound } @signed_in = false end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/balboa/interactor/capybara_interactor.rb', line 10 def @options end |
Instance Method Details
#add_command(key, command) ⇒ Object
18 19 20 |
# File 'lib/balboa/interactor/capybara_interactor.rb', line 18 def add_command(key, command) @commands[key.to_s] = command end |
#last ⇒ Object
22 23 24 25 |
# File 'lib/balboa/interactor/capybara_interactor.rb', line 22 def last login unless signed_in? @commands['last'].execute end |
#punch(date) ⇒ Object
27 28 29 30 |
# File 'lib/balboa/interactor/capybara_interactor.rb', line 27 def punch(date) login unless signed_in? @commands['punch'].execute(date) end |