instance method
method_missing
Ruby on Rails edge
Since edge Private — implementation detail, not part of the public APISignature
method_missing(method_name, *args, **kwargs)
No documentation comment.
Parameters
-
method_namereq -
argsrest -
kwargskeyrest
Source
# File activemodel/lib/active_model/schematized_json.rb, line 81
def method_missing(method_name, *args, **kwargs)
key = method_name.to_s.remove(/(\?|=)/)
if @schema.key? key.to_sym
if method_name.ends_with?("?")
@data[key].present?
elsif method_name.ends_with?("=")
@data[key] = lookup_schema_type_for(key).cast(args.first)
else
@data[key]
end
else
super
end
end
Defined in activemodel/lib/active_model/schematized_json.rb line 81
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::SchematizedJson::DataAccessor