Class: LinkThumbnailer::Models::Video
- Inherits:
-
LinkThumbnailer::Model
- Object
- LinkThumbnailer::Model
- LinkThumbnailer::Models::Video
- Defined in:
- lib/link_thumbnailer/models/video.rb
Instance Attribute Summary collapse
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#embed_code ⇒ Object
readonly
Returns the value of attribute embed_code.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#src ⇒ Object
readonly
Returns the value of attribute src.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(src, size = nil) ⇒ Video
constructor
A new instance of Video.
- #to_s ⇒ Object
Methods inherited from LinkThumbnailer::Model
Constructor Details
#initialize(src, size = nil) ⇒ Video
Returns a new instance of Video.
10 11 12 13 14 15 16 17 |
# File 'lib/link_thumbnailer/models/video.rb', line 10 def initialize(src, size = nil) @src = src @id = parser.id @size = size || parser.size @duration = parser.duration @provider = parser.provider @embed_code = parser. end |
Instance Attribute Details
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
8 9 10 |
# File 'lib/link_thumbnailer/models/video.rb', line 8 def duration @duration end |
#embed_code ⇒ Object (readonly)
Returns the value of attribute embed_code.
8 9 10 |
# File 'lib/link_thumbnailer/models/video.rb', line 8 def @embed_code end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/link_thumbnailer/models/video.rb', line 8 def id @id end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
8 9 10 |
# File 'lib/link_thumbnailer/models/video.rb', line 8 def provider @provider end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
8 9 10 |
# File 'lib/link_thumbnailer/models/video.rb', line 8 def size @size end |
#src ⇒ Object (readonly)
Returns the value of attribute src.
8 9 10 |
# File 'lib/link_thumbnailer/models/video.rb', line 8 def src @src end |
Instance Method Details
#as_json ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/link_thumbnailer/models/video.rb', line 23 def as_json(*) { id: id, src: src.to_s, size: size, duration: duration, provider: provider, embed_code: } end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/link_thumbnailer/models/video.rb', line 19 def to_s src.to_s end |