Sha256: f51eea75c33743f2304f9d6ba0092be8f9af5946f9230d778c3c1184f1ffdb99
Contents?: true
Size: 757 Bytes
Versions: 3
Compression:
Stored size: 757 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 # 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
Version data entries
3 entries across 3 versions & 3 rubygems
Version | Path |
---|---|
wyngle-ripple-0.1.0 | lib/ripple/document/key.rb |
better-ripple-1.0.0 | lib/ripple/document/key.rb |
ripple-1.0.0.beta2 | lib/ripple/document/key.rb |