Sha256: 66c01b05ac5d792c7d66bcd87d69d2a404f1b312933de121db868edc0bdec0c8
Contents?: true
Size: 806 Bytes
Versions: 1
Compression:
Stored size: 806 Bytes
Contents
require 'active_support/concern' module Ripple module Document module Key extend ActiveSupport::Concern module ClassMethods # Defines the key to be derived from a property. # @param [String,Symbol] prop the property to derive the key from def key_on(prop) prop = prop.to_sym define_method(:key) { send(prop).to_s } define_method(:key=) { |v| send(:"#{prop}=", v) } define_method(:key_attr) { prop } end end module InstanceMethods # Reads the key for this Document. def key @key end # Sets the key for this Document. def key=(value) @key = value.to_s end def key_attr :key end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ripple-1.0.0.beta | lib/ripple/document/key.rb |