Class: LinkHeaderParser::LinkHeaderParameter
- Inherits:
-
Object
- Object
- LinkHeaderParser::LinkHeaderParameter
- Defined in:
- lib/link_header_parser/link_header_parameter.rb
Instance Attribute Summary collapse
-
#parameter ⇒ String
readonly
The
String
value used to create this LinkHeaderParameter.
Instance Method Summary collapse
-
#initialize(parameter) ⇒ LinkHeaderParameter
constructor
Create a new parsed Link header parameter.
- #inspect ⇒ String
- #name ⇒ String
-
#to_ary ⇒ Array<String>
(also: #to_a)
Return an
Array
representation of this LinkHeaderParameter. - #value ⇒ String
Constructor Details
#initialize(parameter) ⇒ LinkHeaderParameter
Create a new parsed Link header parameter.
16 17 18 |
# File 'lib/link_header_parser/link_header_parameter.rb', line 16 def initialize(parameter) @parameter = parameter.to_str end |
Instance Attribute Details
#parameter ⇒ String (readonly)
The String
value used to create this LinkHeaderParser::LinkHeaderParameter.
11 12 13 |
# File 'lib/link_header_parser/link_header_parameter.rb', line 11 def parameter @parameter end |
Instance Method Details
#inspect ⇒ String
21 22 23 24 25 |
# File 'lib/link_header_parser/link_header_parameter.rb', line 21 def inspect "#<#{self.class.name}:#{format("%#0x", object_id)} " \ "name: #{name.inspect}, " \ "value: #{value.inspect}>" end |
#name ⇒ String
31 32 33 |
# File 'lib/link_header_parser/link_header_parameter.rb', line 31 def name @name ||= parameter_match_data[:name].downcase end |
#to_ary ⇒ Array<String> Also known as: to_a
Return an Array
representation of this LinkHeaderParser::LinkHeaderParameter.
46 47 48 |
# File 'lib/link_header_parser/link_header_parameter.rb', line 46 def to_ary [name, value] end |
#value ⇒ String
39 40 41 |
# File 'lib/link_header_parser/link_header_parameter.rb', line 39 def value @value ||= parameter_match_data[:value].to_s end |