Methods

Class Index [+]

Quicksearch

DataMapper::Model::Is

Module that provides a common way for plugin authors to implement “is … “ traits (object behaviors that can be shared)

Public Instance Methods

is(plugin, *args, &block) click to toggle source

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

    # File lib/dm-core/model/is.rb, line 19
19:       def is(plugin, *args, &block)
20:         generator_method = "is_#{plugin}".to_sym
21: 
22:         if respond_to?(generator_method)
23:           send(generator_method, *args, &block)
24:         else
25:           raise PluginNotFoundError, "could not find plugin named #{plugin}"
26:         end
27:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.