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/interpolation.rb

Overview

Namespace of the gem.

Defined Under Namespace

Modules: Helper Classes: Interpolation, Link, Parser, Plain, Tag

Class Method Summary collapse

Class Method Details

.it(identifier, options = {}) ⇒ Object

It outside of your views. See documentation at Helper#it



15
16
17
18
# File 'lib/it.rb', line 15

def self.it(identifier, options = {})
  options.stringify_keys!
  Parser.new(I18n.t(identifier, :locale => options["locale"]), options).process
end

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 like article_path. It’s not possible to specify a Hash like {:controller => "articles", :action => "index"} directly. Use the url_for helper, if you would like to specify your links like that.

  • options: The options as an Hash. Use them like you would with link_to. (optional)



26
27
28
# File 'lib/it.rb', line 26

def self.link(href, options = {})
  It::Link.new(href, options)
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)



34
35
36
# File 'lib/it.rb', line 34

def self.plain(template = "%s")
  It::Plain.new(template)
end

.tag(tag_name, options = {}) ⇒ Object

Creates a new tag to be used in it.

  • tag_name: The name of the tag as a Symbol or String.

  • options: The options will become attributes on the tag. (optional)



42
43
44
# File 'lib/it.rb', line 42

def self.tag(tag_name, options = {})
  It::Tag.new(tag_name, options)
end