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.
29 30 31 |
# File 'lib/ehbrs_ruby_utils/videos/quality.rb', line 29 def following @following end |
Class Method Details
.by_height(height) ⇒ Object
17 18 19 |
# File 'lib/ehbrs_ruby_utils/videos/quality.rb', line 17 def by_height(height) list.find { |v| v.height == height } end |
Instance Method Details
#<=>(other) ⇒ Object
35 36 37 |
# File 'lib/ehbrs_ruby_utils/videos/quality.rb', line 35 def <=>(other) height <=> other.height end |
#resolution_match?(resolution) ⇒ Boolean
45 46 47 48 |
# File 'lib/ehbrs_ruby_utils/videos/quality.rb', line 45 def resolution_match?(resolution) (min_height.blank? || resolution.lower >= min_height) && (max_height.blank? || resolution.lower <= max_height) end |
#to_xs ⇒ Object
41 42 43 |
# File 'lib/ehbrs_ruby_utils/videos/quality.rb', line 41 def to_xs "#{height} (Min: #{min_height}, Max: #{max_height})" end |