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.
33 34 35 36 37 38 39 40 |
# File 'app/helpers/bard/static/link_to_helper.rb', line 33 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.
46 47 48 |
# File 'app/helpers/bard/static/link_to_helper.rb', line 46 def context @context end |
#html_options ⇒ Object (readonly)
Returns the value of attribute html_options.
46 47 48 |
# File 'app/helpers/bard/static/link_to_helper.rb', line 46 def @html_options end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
46 47 48 |
# File 'app/helpers/bard/static/link_to_helper.rb', line 46 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
46 47 48 |
# File 'app/helpers/bard/static/link_to_helper.rb', line 46 def @options end |
Class Method Details
.render(*args, &block) ⇒ Object
25 26 27 28 29 30 31 |
# File 'app/helpers/bard/static/link_to_helper.rb', line 25 def self.render *args, &block if block_given? new(*args, &block).render else new(*args).render end end |
Instance Method Details
#render ⇒ Object
42 43 44 |
# File 'app/helpers/bard/static/link_to_helper.rb', line 42 def render "<a #{href_attr}#{}>#{body}</a>".html_safe end |
#url ⇒ Object
48 49 50 |
# File 'app/helpers/bard/static/link_to_helper.rb', line 48 def url context.url_for() end |