Method: Watchful::Action#initialize
- Defined in:
- lib/watchful/action.rb
#initialize(options = {}) ⇒ Action
Returns a new instance of Action.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/watchful/action.rb', line 17 def initialize( = {}) [:dependencies] ||= [] @enabled = true PROPERTIES.each do |key| self.instance_variable_set('@' + key.to_s, [key]) end @dependencies = [@dependencies] if @dependencies.kind_of? String raise ArgumentError.new("Dependencies option must be a string or array") if not @dependencies.kind_of? Array [@in, @out].each do |i| @enabled = false unless i and i.instance_of?(String) and i.starts_with?('.') end @enabled = false unless @command.instance_of?(String) @enabled = false unless self.has_dependencies? end |