Class: EhbrsRubyUtils::Videos::Quality
- Inherits:
-
Object
- Object
- EhbrsRubyUtils::Videos::Quality
- Includes:
- Comparable
- Defined in:
- lib/ehbrs_ruby_utils/videos/quality.rb
Constant Summary collapse
- POSITIVE_MARGIN =
0.75- LIST =
[240, 480, 720, 1080, 2160].freeze
Instance Attribute Summary collapse
-
#following ⇒ Object
readonly
Returns the value of attribute following.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#following ⇒ Object
Returns the value of attribute following.
27 28 29 |
# File 'lib/ehbrs_ruby_utils/videos/quality.rb', line 27 def following @following end |
Class Method Details
.by_height(height) ⇒ Object
15 16 17 |
# File 'lib/ehbrs_ruby_utils/videos/quality.rb', line 15 def by_height(height) list.find { |v| v.height == height } end |
Instance Method Details
#<=>(other) ⇒ Object
33 34 35 |
# File 'lib/ehbrs_ruby_utils/videos/quality.rb', line 33 def <=>(other) height <=> other.height end |
#resolution_match?(resolution) ⇒ Boolean
43 44 45 46 |
# File 'lib/ehbrs_ruby_utils/videos/quality.rb', line 43 def resolution_match?(resolution) (min_height.blank? || resolution.lower >= min_height) && (max_height.blank? || resolution.lower <= max_height) end |
#to_xs ⇒ Object
39 40 41 |
# File 'lib/ehbrs_ruby_utils/videos/quality.rb', line 39 def to_xs "#{height} (Min: #{min_height}, Max: #{max_height})" end |