Class: ActionText::Attachables::RemoteVideo
- Inherits:
-
Object
- Object
- ActionText::Attachables::RemoteVideo
- Extended by:
- ActiveModel::Naming
- Defined in:
- lib/action_text/attachables/remote_video.rb
Instance Attribute Summary collapse
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#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 = {}) ⇒ RemoteVideo
constructor
A new instance of RemoteVideo.
- #to_partial_path ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ RemoteVideo
Returns a new instance of RemoteVideo.
29 30 31 32 33 34 35 |
# File 'lib/action_text/attachables/remote_video.rb', line 29 def initialize(attributes = {}) @url = attributes[:url] @content_type = attributes[:content_type] @width = attributes[:width] @height = attributes[:height] @filename = attributes[:filename] end |
Instance Attribute Details
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
27 28 29 |
# File 'lib/action_text/attachables/remote_video.rb', line 27 def content_type @content_type end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
27 28 29 |
# File 'lib/action_text/attachables/remote_video.rb', line 27 def filename @filename end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
27 28 29 |
# File 'lib/action_text/attachables/remote_video.rb', line 27 def height @height end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
27 28 29 |
# File 'lib/action_text/attachables/remote_video.rb', line 27 def url @url end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
27 28 29 |
# File 'lib/action_text/attachables/remote_video.rb', line 27 def width @width end |
Class Method Details
.from_node(node) ⇒ Object
7 8 9 10 11 |
# File 'lib/action_text/attachables/remote_video.rb', line 7 def from_node(node) if node["url"] && content_type_is_video?(node["content-type"]) new(attributes_from_node(node)) end end |
Instance Method Details
#attachable_plain_text_representation(caption) ⇒ Object
37 38 39 |
# File 'lib/action_text/attachables/remote_video.rb', line 37 def attachable_plain_text_representation(caption) "[#{caption || filename || "Video"}]" end |
#to_partial_path ⇒ Object
41 42 43 |
# File 'lib/action_text/attachables/remote_video.rb', line 41 def to_partial_path "action_text/attachables/remote_video" end |