Class: ConfigManager::Toggles::Boolean

Inherits:
Object
  • Object
show all
Defined in:
lib/config_manager/toggles/boolean.rb

Class Method Summary collapse

Class Method Details

.active?(toggle_def) ⇒ Boolean

Returns:



4
5
6
# File 'lib/config_manager/toggles/boolean.rb', line 4

def self.active?(toggle_def)
 	toggle_def.acceptable_values
end

.from_json(value) ⇒ Object



16
17
18
# File 'lib/config_manager/toggles/boolean.rb', line 16

def self.from_json(value)
  to_json(value)
end

.to_json(value) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/config_manager/toggles/boolean.rb', line 8

def self.to_json(value)
 	if value.is_a?(String)
   	!!(value =~ /^(true|t|yes|y|1)$/i)
 	else
   	value
 	end
end