Sha256: 6535001ed2bf28ec66bad360ae5731b28d160dc200693ae7ed8e967ed88dd7ed
Contents?: true
Size: 391 Bytes
Versions: 53
Compression:
Stored size: 391 Bytes
Contents
class Eco::API::Common::People::DefaultParsers::BooleanParser < Eco::API::Common::Loaders::Parser attribute :boolean def parser(value, deps) value.is_a?(Array) ? value.map { |v| truthy(v) } : truthy(value) end def serializer(value, deps) value.to_s end private def truthy(value) %w[true y yes x].include?(value.to_s.strip.downcase) end end
Version data entries
53 entries across 53 versions & 1 rubygems