Class: Rack::TrafficLogger::OptionInterpreter::Shorthand
- Inherits:
-
Object
- Object
- Rack::TrafficLogger::OptionInterpreter::Shorthand
- Defined in:
- lib/rack/traffic_logger/option_interpreter/shorthand.rb
Constant Summary collapse
- ABBREVIATONS =
{ ge: :get, po: :post, pu: :put, pa: :patch, de: :delete, op: :options, he: :head, tr: :trace, h: :headers, b: :bodies, a: :all, ih: :request_headers, ib: :request_bodies, oh: :response_headers, ob: :response_bodies, o: :only, f: :false }.map { |k, v| [k.to_s, v.to_s] }.to_h
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(input) ⇒ Shorthand
constructor
A new instance of Shorthand.
- #transform ⇒ Object
Constructor Details
#initialize(input) ⇒ Shorthand
Returns a new instance of Shorthand.
32 33 34 |
# File 'lib/rack/traffic_logger/option_interpreter/shorthand.rb', line 32 def initialize(input) @input = input end |
Class Method Details
.transform(input) ⇒ Object
27 28 29 30 |
# File 'lib/rack/traffic_logger/option_interpreter/shorthand.rb', line 27 def self.transform(input) raise ArgumentError, 'Input must be a string' unless String === input new(input).transform end |
Instance Method Details
#transform ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/rack/traffic_logger/option_interpreter/shorthand.rb', line 36 def transform @string = @input.dup ranges hash_rockets_and_symbols wrappers instance_eval @string end |