Sha256: 04e3fc61067b1a940ac4d4ffc2a65eb253afa777ac682bbb50247e1cc95572ee
Contents?: true
Size: 632 Bytes
Versions: 5
Compression:
Stored size: 632 Bytes
Contents
# frozen_string_literal: true require 'forwardable' module Trav3 class Headers extend Forwardable def_delegators :@heads, :each_pair def initialize(args = {}) build(args) end def build(args = {}) @heads ||= {} args.each do |(key, value)| @heads[key] = value end self end def remove(key) @heads.delete(key) end def +(other) raise TypeError, "Headers type expected, #{other.class} given" unless other.is_a? Headers @heads.merge(other.instance_variable_get(:@heads)) self end def to_h @heads end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
trav3-0.3.4 | lib/trav3/headers.rb |
trav3-0.3.3 | lib/trav3/headers.rb |
trav3-0.3.2 | lib/trav3/headers.rb |
trav3-0.3.1 | lib/trav3/headers.rb |
trav3-0.3.0 | lib/trav3/headers.rb |