Class: PageMeta::Link
- Inherits:
-
Object
- Object
- PageMeta::Link
- Defined in:
- lib/page_meta/link.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#rel ⇒ Object
readonly
Returns the value of attribute rel.
Class Method Summary collapse
Instance Method Summary collapse
- #helpers ⇒ Object
-
#initialize(rel, options) ⇒ Link
constructor
A new instance of Link.
- #render ⇒ Object
Constructor Details
#initialize(rel, options) ⇒ Link
Returns a new instance of Link.
17 18 19 20 |
# File 'lib/page_meta/link.rb', line 17 def initialize(rel, ) @rel = rel.to_s.dasherize @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
15 16 17 |
# File 'lib/page_meta/link.rb', line 15 def @options end |
#rel ⇒ Object (readonly)
Returns the value of attribute rel.
15 16 17 |
# File 'lib/page_meta/link.rb', line 15 def rel @rel end |
Class Method Details
.build(rel, options) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/page_meta/link.rb', line 5 def self.build(rel, ) klass_name = "::PageMeta::Link::#{rel.to_s.camelize}" klass = begin const_get(klass_name) rescue ActionView::Template::Error, NameError Link end klass.new(rel, ) end |
Instance Method Details
#helpers ⇒ Object
26 27 28 |
# File 'lib/page_meta/link.rb', line 26 def helpers ActionController::Base.helpers end |
#render ⇒ Object
22 23 24 |
# File 'lib/page_meta/link.rb', line 22 def render helpers.tag(:link, .merge(rel:)) unless .empty? end |