Sha256: 69403f8907191cec30c5ea322ef2ea1e95cf3998b0d43228c2ce94c37a73f61f

Contents?: true

Size: 1.27 KB

Versions: 18

Compression:

Stored size: 1.27 KB

Contents

module Mobility
=begin

Plugins allow modular customization of backends independent of the backend
itself. They are enabled through the {Configuration.plugins} configuration
setting, which takes an array of symbols corresponding to plugin names. The
order of these names is important since it determines the order in which
plugins will be applied.

So if our {Configuration.plugins} is an array +[:foo]+, and we call
`translates` on our model, +Post+, like this:

  class Post
    translates :title, foo: true
  end

Then the +Foo+ plugin will be applied with the option value +true+. Applying a
module calls a class method, +apply+ (in this case +Foo.apply+), which takes
two arguments:

- an instance of the {Attributes} class, +attributes+, from which the backend
  can configure the backend class (+attributes.backend_class+) and the model
  (+attributes.model_class+), and the +attributes+ module itself (which
  will be included into the backend).
- the value of the +option+ passed into the model with +translates+ (in this
  case, +true+).

Typically, the plugin will include a module into either
+attributes.backend_class+ or +attributes+ itself, configured according to the
option value. For examples, see classes under the {Mobility::Plugins} namespace.

=end
  module Plugins
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
mobility-0.6.0 lib/mobility/plugins.rb
mobility-0.5.1 lib/mobility/plugins.rb
mobility-0.5.0 lib/mobility/plugins.rb
mobility-0.4.3 lib/mobility/plugins.rb
mobility-0.4.2 lib/mobility/plugins.rb
mobility-0.4.1 lib/mobility/plugins.rb
mobility-0.4.0 lib/mobility/plugins.rb
mobility-0.3.6 lib/mobility/plugins.rb
mobility-0.3.5 lib/mobility/plugins.rb
mobility-0.3.4 lib/mobility/plugins.rb
mobility-0.3.3 lib/mobility/plugins.rb
mobility-0.3.2 lib/mobility/plugins.rb
mobility-0.3.1 lib/mobility/plugins.rb
mobility-0.3.0 lib/mobility/plugins.rb
mobility-0.2.3 lib/mobility/plugins.rb
mobility-0.2.2 lib/mobility/plugins.rb
mobility-0.2.1 lib/mobility/plugins.rb
mobility-0.2.0 lib/mobility/plugins.rb