Sha256: 9a1caced2a1b2969cf17843e418d42679c74deb4f1337b3bbe53c003a77fc054
Contents?: true
Size: 884 Bytes
Versions: 2
Compression:
Stored size: 884 Bytes
Contents
module DataMapper module Model # Module that provides a common way for plugin authors # to implement "is ... " traits (object behaviors that can be shared) module Is # A common interface to activate plugins for a resource. For instance: # # class Widget # include DataMapper::Resource # # is :list # end # # adds list item behavior to the model. Plugin that wants to conform # to "is API" of DataMapper must supply is_+behavior name+ method, # for example above it would be is_list. # # @api public def is(plugin, *args, &block) generator_method = "is_#{plugin}".to_sym raise PluginNotFoundError, "could not find plugin named #{plugin}" unless respond_to?(generator_method) send(generator_method, *args, &block) end end include Is end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sbf-dm-core-1.3.0 | lib/dm-core/model/is.rb |
sbf-dm-core-1.3.0.beta | lib/dm-core/model/is.rb |