Sha256: 8f04ea8af0a40a591a7bc49578ce42db45e89da12a2536d9909e2e4d223fb4c4
Contents?: true
Size: 643 Bytes
Versions: 1
Compression:
Stored size: 643 Bytes
Contents
module Fathom module ContextBehavior module ClassMethods def default_class(value=nil) @default_class = value if value @default_class end def new(*attrs, &block) target = attrs.shift target ||= default_class.new if default_class raise ArgumentError, "You must provide a target object to build this context." unless target obj = super(*attrs, &block) obj.send(:instance_variable_set, :@object, target) obj end end module InstanceMethods attr_reader :object end def self.configure(base) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fathom-0.5.0 | lib/fathom/behaviors/context_behavior.rb |