-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serializer context #80
Conversation
Add alias `serializer_contexts`
array.each { |method| define_method(method) { context[method] } } | ||
end | ||
|
||
# Plural form ¯\_(ツ)_/¯ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use only ascii symbols in comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope
lib/surrealist/serializer.rb
Outdated
# | ||
# @raise ArgumentError if type of argument is not an array of symbols | ||
def serializer_context(*array) | ||
unless array.reject(&-> (i) { i.is_a?(Symbol) }).empty? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax looks kind of crazy here, can we make this more readable?
unless array.all? { |i| i.is_a? Symbol }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me. Very interesting uses of prepend
within the specs, I have not seen this keyword used much before
#67
Added
.serializer_context
class method forSurrealist::Serializer
and alias.serializer_contexts