Skip to content
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

Add basic attribute Type coercion #2

Open
postmodern opened this issue Oct 18, 2016 · 0 comments
Open

Add basic attribute Type coercion #2

postmodern opened this issue Oct 18, 2016 · 0 comments

Comments

@postmodern
Copy link

postmodern commented Oct 18, 2016

I was evaluating Redis ORM/Model libraries and noticed redis-orm did not support attribute types. Basic attribute types could be added to coerce the String values loaded from Redis back into native Ruby types. Example:

TYPES = {
  ...
  Date => proc { |value| Date.parse(value) if value },
  ...
}

class Homework < Redis::ORM
  attribute :description
  attribute :due_date, Date
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant