Sha256: 2f50c4c4f586161daf4d43dd7016775a723558089da151d43a2fb376bddce786
Contents?: true
Size: 720 Bytes
Versions: 2
Compression:
Stored size: 720 Bytes
Contents
module Sham class << self def config klass, name = :default unless klass.include?(Sham::Shammable) klass.send(:include, Sham::Shammable) end yield(Sham::Config.new(klass, name)) end end class Config def self.activate! root = nil root = Rails.root if root.nil? && defined?(Rails.root) root = File.join(root, 'sham', '**', '*.rb') Dir[root].each{ |f| load(f) } end attr_accessor :klass, :name def initialize klass, name self.klass = klass self.name = name end def attributes &config klass.add_sham_config(name, config) end def empty klass.add_sham_config(name, Proc.new{ Hash.new() }) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sham-1.0.2 | lib/sham/config.rb |
sham-1.0.1 | lib/sham/config.rb |