Class: Bard::Static::LinkToHelper::LinkTo
- Inherits:
-
Object
- Object
- Bard::Static::LinkToHelper::LinkTo
- Defined in:
- app/helpers/bard/static/link_to_helper.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#html_options ⇒ Object
readonly
Returns the value of attribute html_options.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(context, name, options = {}, html_options = {}) {|_self| ... } ⇒ LinkTo
constructor
A new instance of LinkTo.
- #render ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(context, name, options = {}, html_options = {}) {|_self| ... } ⇒ LinkTo
Returns a new instance of LinkTo.
32 33 34 35 36 37 38 39 |
# File 'app/helpers/bard/static/link_to_helper.rb', line 32 def initialize context, name, = {}, = {}, &block @context = context @name = name @options = || {} @html_options = HashWithIndifferentAccess.new() @html_options = @context.send(:convert_options_to_data_attributes, @options, @html_options) yield self if block_given? end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
45 46 47 |
# File 'app/helpers/bard/static/link_to_helper.rb', line 45 def context @context end |
#html_options ⇒ Object (readonly)
Returns the value of attribute html_options.
45 46 47 |
# File 'app/helpers/bard/static/link_to_helper.rb', line 45 def @html_options end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
45 46 47 |
# File 'app/helpers/bard/static/link_to_helper.rb', line 45 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
45 46 47 |
# File 'app/helpers/bard/static/link_to_helper.rb', line 45 def @options end |
Class Method Details
.render(*args, &block) ⇒ Object
24 25 26 27 28 29 30 |
# File 'app/helpers/bard/static/link_to_helper.rb', line 24 def self.render *args, &block if block_given? new(*args, &block).render else new(*args).render end end |
Instance Method Details
#render ⇒ Object
41 42 43 |
# File 'app/helpers/bard/static/link_to_helper.rb', line 41 def render "<a #{href_attr}#{}>#{body}</a>".html_safe end |
#url ⇒ Object
47 48 49 |
# File 'app/helpers/bard/static/link_to_helper.rb', line 47 def url context.url_for() end |