Module: WrapIt
- Defined in:
- lib/wrap_it/helpers.rb,
lib/wrap_it/base.rb,
lib/wrap_it/html.rb,
lib/wrap_it/link.rb,
lib/wrap_it/enums.rb,
lib/wrap_it/rails.rb,
lib/wrap_it/version.rb,
lib/wrap_it/no_rails.rb,
lib/wrap_it/sections.rb,
lib/wrap_it/switches.rb,
lib/wrap_it/arguments.rb,
lib/wrap_it/callbacks.rb,
lib/wrap_it/container.rb,
lib/wrap_it/html_data.rb,
lib/wrap_it/frameworks.rb,
lib/wrap_it/html_class.rb,
lib/wrap_it/capture_array.rb,
lib/wrap_it/text_container.rb,
lib/wrap_it/derived_attributes.rb
Overview
Registering helpers
To use your classes and helpers in templates you should register your
library. First, in your framework initialization, you should register
your library in WrapIt. You can have separate module for it or WrapIt
will make anonymous one. After this, your module will have register
and unregister methods to register your classes.
Defined Under Namespace
Modules: Arguments, Callbacks, CaptureArray, DerivedAttributes, Enums, HTML, Renderer, Sections, Switches, TextContainer Classes: Base, Container, HTMLClass, HTMLData, Link
Constant Summary collapse
- VERSION =
Current gem version
'1.0.2'
Class Method Summary collapse
-
.register_module(mod = nil, opts = {}) ⇒ void
Registers helpers module.
Instance Method Summary collapse
-
#register([name, ...], class_name) ⇒ Object
adds to template list of helpers for creating elements of specified class.
Class Method Details
.register_module(mod = nil, opts = {}) ⇒ void
This method returns an undefined value.
Registers helpers module
62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/wrap_it/helpers.rb', line 62 def self.register_module(*args) = args. .symbolize_keys! = {prefix: ''}.merge() mod = args.shift mod.is_a?(Module) || mod = Module.new mod.instance_eval do define_singleton_method(:register, &WrapIt.register_block()) define_singleton_method(:unregister, &WrapIt.unregister_block()) end mod end |
Instance Method Details
#register([name, ...], class_name) ⇒ Object
adds to template list of helpers for creating elements of specified class
|
|
# File 'lib/wrap_it/helpers.rb', line 75
|