lib/king_konf/variable.rb in king_konf-0.2.0 vs lib/king_konf/variable.rb in king_konf-0.3.0

- old
+ new

@@ -28,10 +28,11 @@ when :string then value.is_a?(String) || value.nil? when :list then value.is_a?(Array) when :integer then value.is_a?(Integer) || value.nil? when :float then value.is_a?(Float) || value.is_a?(Integer) || value.nil? when :boolean then value == true || value == false + when :symbol then value.is_a?(Symbol) else raise "invalid type #{@type}" end end def allowed?(value) @@ -40,10 +41,10 @@ def decode(value) Decoder.public_send(@type, value, **options) end - %i(boolean integer float string list).each do |type| + TYPES.each do |type| define_method("#{type}?") do @type == type end end end