Class: HTTP::Accept::Encodings::ContentCoding
- Inherits:
-
Struct
- Object
- Struct
- HTTP::Accept::Encodings::ContentCoding
- Defined in:
- lib/http/accept/encodings.rb
Instance Attribute Summary collapse
-
#encoding ⇒ Object
Returns the value of attribute encoding.
-
#q ⇒ Object
Returns the value of attribute q.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#encoding ⇒ Object
Returns the value of attribute encoding
24 25 26 |
# File 'lib/http/accept/encodings.rb', line 24 def encoding @encoding end |
#q ⇒ Object
Returns the value of attribute q
24 25 26 |
# File 'lib/http/accept/encodings.rb', line 24 def q @q end |
Class Method Details
.parse(scanner) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/http/accept/encodings.rb', line 29 def self.parse(scanner) return to_enum(:parse, scanner) unless block_given? while scanner.scan(CODINGS) yield self.new(scanner[:encoding], scanner[:q]) # Are there more? break unless scanner.scan(/\s*,\s*/) end raise ParseError.new('Could not parse entire string!') unless scanner.eos? end |
Instance Method Details
#quality_factor ⇒ Object
25 26 27 |
# File 'lib/http/accept/encodings.rb', line 25 def quality_factor (q || 1.0).to_f end |