Sha256: d0c560cbd82905634ced85abb660e4cd2de23f9947e416aaffbd0f3efb3b7394
Contents?: true
Size: 610 Bytes
Versions: 4
Compression:
Stored size: 610 Bytes
Contents
module CGIParty class Response attr_reader :received_at def initialize(source_data) @source_data = source_data @received_at = Time.now end def method_missing(method_name, *args, &block) return fetch_value(method_name) if key_present?(method_name) super end def respond_to_missing?(method_name, include_private = false) key_present?(method_name) || super end private def fetch_value(key) @source_data.values.first.fetch(key.to_sym, nil) end def key_present?(key) @source_data.values.first.key?(key) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
cgi_party-2.0.1 | lib/cgi_party/response.rb |
cgi_party-2.0.0 | lib/cgi_party/response.rb |
cgi_party-1.0.0 | lib/cgi_party/response.rb |
cgi_party-0.1.1 | lib/cgi_party/response.rb |