Class: ActionMosaico::Attachables::ContentAttachment
- Inherits:
-
Object
- Object
- ActionMosaico::Attachables::ContentAttachment
- Includes:
- ActiveModel::Model
- Defined in:
- lib/action_mosaico/attachables/content_attachment.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #attachable_plain_text_representation(_caption) ⇒ Object
- #to_mosaico_content_attachment_partial_path ⇒ Object
- #to_partial_path ⇒ Object
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
15 16 17 |
# File 'lib/action_mosaico/attachables/content_attachment.rb', line 15 def name @name end |
Class Method Details
.from_node(node) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/action_mosaico/attachables/content_attachment.rb', line 8 def self.from_node(node) if node['content-type'] && matches = node['content-type'].match(/vnd\.rubyonrails\.(.+)\.html/) = new(name: matches[1]) if .valid? end end |
Instance Method Details
#attachable_plain_text_representation(_caption) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/action_mosaico/attachables/content_attachment.rb', line 19 def attachable_plain_text_representation() case name when 'horizontal-rule' ' ┄ ' else ' ' end end |
#to_mosaico_content_attachment_partial_path ⇒ Object
32 33 34 |
# File 'lib/action_mosaico/attachables/content_attachment.rb', line 32 def "action_mosaico/attachables/content_attachments/#{name.underscore}" end |
#to_partial_path ⇒ Object
28 29 30 |
# File 'lib/action_mosaico/attachables/content_attachment.rb', line 28 def to_partial_path 'action_mosaico/attachables/content_attachment' end |