Class: Flagon::Loader::HashLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/flagon/loader/hash_loader.rb

Instance Method Summary collapse

Constructor Details

#initialize(init_hash) ⇒ HashLoader

Returns a new instance of HashLoader.



4
5
6
7
8
# File 'lib/flagon/loader/hash_loader.rb', line 4

def initialize(init_hash)
  @flags = init_hash.each_with_object({}) do |kv,flags|
    flags[to_key(kv[0])] = (kv[1] == 'on')
  end
end

Instance Method Details

#exists?(flag_name) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/flagon/loader/hash_loader.rb', line 10

def exists?(flag_name)
  flags.has_key?(to_key(flag_name))
end

#get_flag(flag_name) ⇒ Object



14
15
16
# File 'lib/flagon/loader/hash_loader.rb', line 14

def get_flag(flag_name)
  flags[to_key(flag_name)]
end