lib/eco/api/common/people/default_parsers/boolean_parser.rb in eco-helpers-1.5.1 vs lib/eco/api/common/people/default_parsers/boolean_parser.rb in eco-helpers-1.5.2

- old
+ new

@@ -1,28 +1,18 @@ -module Eco - module API - module Common - module People - class DefaultParsers - class BooleanParser < People::BaseParser +class Eco::API::Common::People::DefaultParsers::BooleanParser < Eco::API::Common::Loaders::Parser + attribute :boolean - def process - @parsers.define_attribute(:boolean) do |parser| - parser.def_parser do |value| - value.is_a?(Array) ? value.map { |v| truthy(v) } : truthy(value) - end.def_serializer do |value| - value.to_s - end - end - end + def parser(value, deps) + value.is_a?(Array) ? value.map { |v| truthy(v) } : truthy(value) + end - private + def serializer(value, deps) + value.to_s + end - def truthy (value) - %w[true y yes x].include?(value.to_s.strip.downcase) - end - end - end - end - end + private + + def truthy (value) + %w[true y yes x].include?(value.to_s.strip.downcase) end + end