Sha256: f03a09b8cc88b70c45f3a897e80c3af22865965e325df09f8be834f1e246fc8f
Contents?: true
Size: 462 Bytes
Versions: 6
Compression:
Stored size: 462 Bytes
Contents
module Aitch class DSL %w[url options headers data].each do |name| class_eval <<-RUBY attr_writer :#{name} def #{name}(*args) @#{name} = args.first if args.any? @#{name} end RUBY end alias_method :params, :data alias_method :body, :data def to_h { url: url, options: options || {}, headers: headers || {}, data: data } end end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
aitch-0.5.0 | lib/aitch/dsl.rb |
aitch-0.4.1 | lib/aitch/dsl.rb |
aitch-0.4.0 | lib/aitch/dsl.rb |
aitch-0.3.0 | lib/aitch/dsl.rb |
aitch-0.2.1 | lib/aitch/dsl.rb |
aitch-0.2.0 | lib/aitch/dsl.rb |