Class: Texter::TextPresenter
- Inherits:
-
Object
- Object
- Texter::TextPresenter
- Defined in:
- app/presenters/texter/text_presenter.rb
Instance Attribute Summary collapse
-
#h ⇒ Object
readonly
Returns the value of attribute h.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(text, h, options = {}) ⇒ TextPresenter
constructor
A new instance of TextPresenter.
- #path_for_class ⇒ Object
Constructor Details
#initialize(text, h, options = {}) ⇒ TextPresenter
Returns a new instance of TextPresenter.
8 9 10 11 12 13 14 |
# File 'app/presenters/texter/text_presenter.rb', line 8 def initialize(text, h, = {}) @text = text @h = h @options = .assert_valid_keys(:locale, :formatter, :formatter_options) end |
Instance Attribute Details
#h ⇒ Object (readonly)
Returns the value of attribute h.
4 5 6 |
# File 'app/presenters/texter/text_presenter.rb', line 4 def h @h end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'app/presenters/texter/text_presenter.rb', line 4 def @options end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
4 5 6 |
# File 'app/presenters/texter/text_presenter.rb', line 4 def text @text end |
Instance Method Details
#body ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/presenters/texter/text_presenter.rb', line 16 def body return formatted unless can_be_edited? h.content_tag(content_tag_name, formatted, { :data => { :url => h.texter.edit_text_path(path, :js, :text => { :tag_type => tag_type }) }, :class => "js-edit #{path_for_class}" }) end |
#path_for_class ⇒ Object
29 30 31 |
# File 'app/presenters/texter/text_presenter.rb', line 29 def path_for_class path.gsub(/\./, '-') end |