Module: It
- Defined in:
- lib/it.rb,
lib/it/tag.rb,
lib/it/link.rb,
lib/it/plain.rb,
lib/it/helper.rb,
lib/it/parser.rb,
lib/it/version.rb,
lib/it/interpolation.rb
Overview
Namespace of the gem.
Defined Under Namespace
Modules: Helper Classes: Interpolation, Link, Parser, Plain, Tag
Constant Summary collapse
- VERSION =
'2.0.0'.freeze
Class Method Summary collapse
-
.it(identifier, options = {}) ⇒ Object
It outside of your views.
-
.link(href, options = {}) ⇒ Object
Creates a new link to be used in
it
. -
.plain(template = '%s') ⇒ Object
Creates a new plain replacement to be used in
it
. -
.tag(tag_name, options = {}) ⇒ Object
Creates a new tag to be used in
it
.
Class Method Details
.it(identifier, options = {}) ⇒ Object
It outside of your views. See documentation at Helper#it
16 17 18 19 20 21 |
# File 'lib/it.rb', line 16 def self.it(identifier, = {}) Parser.new( I18n.t(identifier, **Parser.().symbolize_keys), .stringify_keys ).process end |
.link(href, options = {}) ⇒ Object
Creates a new link to be used in it
.
-
href
: The url for the link. You may specify it as a String or as a named route likearticle_path
. It’s not possible to specify a Hash like{controller: "articles", action: "index"}
directly. Use theurl_for
helper, if you would like to specify your links like that. -
options
: The options as an Hash. Use them like you would withlink_to
. (optional)
29 30 31 |
# File 'lib/it.rb', line 29 def self.link(href, = {}) It::Link.new(href, ) end |
.plain(template = '%s') ⇒ Object
Creates a new plain replacement to be used in it
.
-
template
: A string to be used as the template. An example would be"%s[http://www.rubyonrails.org]"
. Defaults to"%s"
. (optional)
37 38 39 |
# File 'lib/it.rb', line 37 def self.plain(template = '%s') It::Plain.new(template) end |