Class: Babar::Action
- Inherits:
-
Object
- Object
- Babar::Action
- Defined in:
- lib/babar/action.rb
Instance Method Summary collapse
- #applies?(file) ⇒ Boolean
- #auto? ⇒ Boolean
-
#initialize(target, action, opts = {}) ⇒ Action
constructor
A new instance of Action.
- #notify ⇒ Object
- #perform ⇒ Object
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
13 14 15 |
# File 'lib/babar/action.rb', line 13 def applies? file file =~ @target end |
#auto? ⇒ Boolean
9 10 11 |
# File 'lib/babar/action.rb', line 9 def auto? @auto end |
#notify ⇒ Object
21 22 23 |
# File 'lib/babar/action.rb', line 21 def notify puts "\e[0m* \e[1;33m#{@action}" end |
#perform ⇒ Object
17 18 19 |
# File 'lib/babar/action.rb', line 17 def perform puts `#{@action}` end |