Class: Watchful::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/watchful/configuration.rb

Direct Known Subclasses

DefaultConfiguration

Constant Summary collapse

@@active_configuration =
nil

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.actionsObject (readonly)

Returns the value of attribute actions.



19
20
21
# File 'lib/watchful/configuration.rb', line 19

def actions
  @actions
end

Class Method Details

._descriptionObject



21
# File 'lib/watchful/configuration.rb', line 21

def _description; @description; end

.action(args) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/watchful/configuration.rb', line 25

def action(args)
	# set the description in case the user doesn’t
	@description ||= 'Custom Configuration'
	
	# set to active configuration
	@@active_configuration = self
	
	# todo: support block-style action definition
	@actions ||= []
	a = Watchful::Action.new(args)
	@actions << a
end

.action_for_file(path) ⇒ Object



12
13
14
15
# File 'lib/watchful/configuration.rb', line 12

def self.action_for_file(path)
	@actions ||= []
	@actions.find { |a| a.input_file?(path) && a.enabled?} 
end

.active_configurationObject



9
# File 'lib/watchful/configuration.rb', line 9

def self.active_configuration; @@active_configuration; end

.active_configuration=(x) ⇒ Object



10
# File 'lib/watchful/configuration.rb', line 10

def self.active_configuration=(x); @@active_configuration = x; end

.description(s) ⇒ Object



23
# File 'lib/watchful/configuration.rb', line 23

def description(s); @description = s; end