lib/fflags/api.rb in fflags-0.3.0 vs lib/fflags/api.rb in fflags-0.3.1

- old
+ new

@@ -8,19 +8,19 @@ def flags client.all(key) end def enabled?(flag_name) - get_flag(flag_name) == true + truthy?(get_flag(flag_name)) end def set_flag(flag_name, bool) client.set(key, flag_name, bool) end def get_flag(flag_name) - truthy?(client.get(key, flag_name)) + client.get(key, flag_name) end def toggle_flag(flag_name) set_flag(flag_name, !get_flag(flag_name)) end @@ -28,11 +28,16 @@ def reset client.reset(key) load_flags end + def flag_exist?(flag_name) + !get_flag(flag_name).nil? + end + def load_flags default_flags.each do |flag, bool| + next if flag_exist?(flag) set_flag(flag, bool) end end private