Class: PryToggle::Exec

Inherits:
Object
  • Object
show all
Defined in:
lib/pry_toggle/exec.rb

Instance Method Summary collapse

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 "=== Invalid command format. should be like that. ===\n$ pry-on exmain.rb:10\n      DOC\n    else\n      puts <<-DOC\n=== Invalid command format. should be like that. ===\n$ pry-off exmain.rb:10\n      DOC\n    end\n\n\n  end\nend\n"

Instance Method Details

#executable?Boolean

Returns:

  • (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