Sha256: 5f237fbcb844dc723aeb3e0728d9e117e906eef86988fa6ffe355b309b70bdf6
Contents?: true
Size: 1.33 KB
Versions: 3
Compression:
Stored size: 1.33 KB
Contents
require 'set' require 'blockenspiel' require 'active_support' require 'active_support/version' %w{ active_support/core_ext/hash/slice active_support/core_ext/class/attribute_accessors active_support/core_ext/object/blank active_support/core_ext/array/wrap active_support/core_ext/module/aliasing }.each do |active_support_3_requirement| require active_support_3_requirement end if ActiveSupport::VERSION::MAJOR == 3 $:.unshift File.dirname(__FILE__) require 'characterizable/base' require 'characterizable/better_hash' require 'characterizable/characteristic' require 'characterizable/snapshot' module Characterizable def self.included(klass) klass.cattr_accessor :characterizable_base klass.extend ClassMethods end def characteristics @_characteristics ||= Snapshot.new self end def expire_snapshot! @_characteristics = nil end def display_characteristic(name) characteristic = self.class.characteristics[name] characteristic.display(characteristics) if characteristic end module ClassMethods def characterize(&block) self.characterizable_base ||= Characterizable::Base.new self Blockenspiel.invoke block, characterizable_base end def characteristics characterizable_base.characteristics end end class CharacteristicAlreadyDefined < ArgumentError; end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
characterizable-0.1.2 | lib/characterizable.rb |
characterizable-0.1.1 | lib/characterizable.rb |
characterizable-0.1.0 | lib/characterizable.rb |