Skip to content

Add basic attribute Type coercion #2

@postmodern

Description

@postmodern

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions