Class: ActionText::Attachables::RemoteImage
- Inherits:
-
Object
- Object
- ActionText::Attachables::RemoteImage
- Extended by:
- ActiveModel::Naming
- Defined in:
- lib/action_text/attachables/remote_image.rb
Instance Attribute Summary collapse
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Class Method Summary collapse
Instance Method Summary collapse
- #attachable_plain_text_representation(caption) ⇒ Object
-
#initialize(attributes = {}) ⇒ RemoteImage
constructor
A new instance of RemoteImage.
- #to_partial_path ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ RemoteImage
Returns a new instance of RemoteImage.
32 33 34 35 36 37 |
# File 'lib/action_text/attachables/remote_image.rb', line 32 def initialize(attributes = {}) @url = attributes[:url] @content_type = attributes[:content_type] @width = attributes[:width] @height = attributes[:height] end |
Instance Attribute Details
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
30 31 32 |
# File 'lib/action_text/attachables/remote_image.rb', line 30 def content_type @content_type end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
30 31 32 |
# File 'lib/action_text/attachables/remote_image.rb', line 30 def height @height end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
30 31 32 |
# File 'lib/action_text/attachables/remote_image.rb', line 30 def url @url end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
30 31 32 |
# File 'lib/action_text/attachables/remote_image.rb', line 30 def width @width end |
Class Method Details
.from_node(node) ⇒ Object
11 12 13 14 15 |
# File 'lib/action_text/attachables/remote_image.rb', line 11 def from_node(node) if node["url"] && content_type_is_image?(node["content-type"]) new(attributes_from_node(node)) end end |
Instance Method Details
#attachable_plain_text_representation(caption) ⇒ Object
39 40 41 |
# File 'lib/action_text/attachables/remote_image.rb', line 39 def attachable_plain_text_representation() "[#{ || "Image"}]" end |
#to_partial_path ⇒ Object
43 44 45 |
# File 'lib/action_text/attachables/remote_image.rb', line 43 def to_partial_path "action_text/attachables/remote_image" end |