Module: Corral

Defined in:
lib/corral.rb,
lib/corral/feature.rb,
lib/corral/helpers.rb,
lib/corral/version.rb

Defined Under Namespace

Modules: Helpers Classes: Feature

Constant Summary collapse

VERSION =
"0.1.3"

Class Method Summary collapse

Class Method Details

.corral(env = nil, &block) ⇒ Object



14
15
16
17
# File 'lib/corral.rb', line 14

def self.corral(env = nil, &block)
  self.environment = env.to_s
  instance_eval(&block)
end

.disable(feature, options = {}) ⇒ Object



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

def self.disable(feature, options = {})
  flip_feature(feature, options.merge(enable: false))
end

.disabled?(feature, *arguments) ⇒ Boolean

Returns:



27
28
29
# File 'lib/corral.rb', line 27

def self.disabled?(feature, *arguments)
  !self.enabled?(feature, *arguments)
end

.enable(feature, options = {}) ⇒ Object



23
24
25
# File 'lib/corral.rb', line 23

def self.enable(feature, options = {})
  flip_feature(feature, options.merge(enable: true))
end

.enabled?(feature, *arguments) ⇒ Boolean

Returns:



31
32
33
34
35
36
# File 'lib/corral.rb', line 31

def self.enabled?(feature, *arguments)
  (feature = Feature.get(feature)) && (condition = feature.condition) or
    return false

  call_condition(feature, condition, *arguments)
end

.environmentObject



6
7
8
# File 'lib/corral.rb', line 6

def self.environment
  @environment
end

.environment=(env) ⇒ Object



10
11
12
# File 'lib/corral.rb', line 10

def self.environment=(env)
  @environment = env.to_sym
end