Class: Babar::Action

Inherits:
Object
  • Object
show all
Defined in:
lib/babar/action.rb

Instance Method Summary collapse

Constructor Details

#initialize(target, action, opts = {}) ⇒ Action

Returns a new instance of Action.



3
4
5
6
7
# File 'lib/babar/action.rb', line 3

def initialize target, action, opts={}
  @target = /#{target}/
  @action = action
  @auto   = opts[:auto]
end

Instance Method Details

#applies?(file) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/babar/action.rb', line 13

def applies? file
  file =~ @target
end

#auto?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/babar/action.rb', line 9

def auto?
  @auto
end

#notifyObject



21
22
23
# File 'lib/babar/action.rb', line 21

def notify
  puts "\e[0m* \e[1;33m#{@action}"
end

#performObject



17
18
19
# File 'lib/babar/action.rb', line 17

def perform
  puts `#{@action}`
end