Sha256: ddc788d507c990d81c8435094e5faecb0118fae01fc83504b27b790adb894e8d

Contents?: true

Size: 836 Bytes

Versions: 1

Compression:

Stored size: 836 Bytes

Contents

require 'watchful/action'

module Watchful

	class Configuration
		
		@@active_configuration = nil
		
		def self.active_configuration; @@active_configuration; end
		def self.active_configuration=(x)
			unless x.is_a? Class and x.ancestors.include? Watchful::Configuration
				throw "Not a valid configuration class"
			end
			@@active_configuration = x
		end
		
		class << self
		
			attr_reader :actions
		
			def description(s); @description = s; end
			
			def _description; @description; end
		
			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-passing style
				@actions ||= []
				a = Watchful::Action.new(args)
				@actions << a
			end
		
		end
		
	end
	
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
watchful-0.0.0.pre1 lib/watchful/configuration.rb