lib/alba.rb in alba-3.1.0 vs lib/alba.rb in alba-3.2.0
- old
+ new
@@ -168,19 +168,19 @@
@_on_nil = nil
@types = {}
register_default_types
end
- private
-
# This method could be part of public API, but for now it's private
def resource_with(object, &block)
klass = block ? resource_class(&block) : infer_resource_class(object.class.name)
klass.new(object)
end
+ private
+
def inflector_from(name_or_module)
case name_or_module
when nil then nil
when :default, :active_support
require_relative 'alba/default_inflector'
@@ -239,10 +239,10 @@
inflector
end
def register_default_types
[String, :String].each do |t|
- register_type(t, check: ->(obj) { obj.is_a?(String) }, converter: ->(obj) { obj.to_s })
+ register_type(t, check: ->(obj) { obj.is_a?(String) }, converter: lambda(&:to_s))
end
[Integer, :Integer].each do |t|
register_type(t, check: ->(obj) { obj.is_a?(Integer) }, converter: ->(obj) { Integer(obj) })
end
register_type(:Boolean, check: ->(obj) { [true, false].include?(obj) }, converter: ->(obj) { !!obj })