Class: PryToggle::Exec
- Inherits:
-
Object
- Object
- PryToggle::Exec
- Defined in:
- lib/pry_toggle/exec.rb
Instance Method Summary collapse
- #executable? ⇒ Boolean
- #execute! ⇒ Object
-
#initialize(args, hash) ⇒ Exec
constructor
A new instance of Exec.
Constructor Details
#initialize(args, hash) ⇒ Exec
Returns a new instance of Exec.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/pry_toggle/exec.rb', line 5 def initialize(args, hash) if args.first =~ /\A(.+):(\d+?)\z/ @service = PryToggle::Service.new($1, $2.to_i, '', "binding.pry\n", hash[:on]) else if hash[:on] puts <<-DOC === Invalid command format. should be like that. === $ pry-on example.rb:10 DOC else puts <<-DOC === Invalid command format. should be like that. === $ pry-off example.rb:10 DOC end end end |
Instance Method Details
#executable? ⇒ Boolean
29 30 31 |
# File 'lib/pry_toggle/exec.rb', line 29 def executable? !!@service end |
#execute! ⇒ Object
25 26 27 |
# File 'lib/pry_toggle/exec.rb', line 25 def execute! @service.execute end |