Module: It

Defined in:
lib/it.rb,
lib/it/tag.rb,
lib/it/link.rb,
lib/it/plain.rb,
lib/it/helper.rb

Overview

Namespace of the gem.

Defined Under Namespace

Modules: Helper Classes: Link, Plain, Tag

Class Method Summary (collapse)

Class Method Details

+ (Object) it(identifier, options = {})

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



13
14
15
16
# File 'lib/it.rb', line 13

def self.it(identifier, options = {})
  options.stringify_keys!
  process(I18n.t(identifier, :locale => options["locale"]), options)
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)



24
25
26
# File 'lib/it.rb', line 24

def self.link(href, options = {})
  It::Link.new(href, options)
end

+ (Object) plain(template = "%s")

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)



32
33
34
# File 'lib/it.rb', line 32

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

+ (Object) tag(tag_name, options = {})

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)



40
41
42
# File 'lib/it.rb', line 40

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