Class: DTK::Network::Client::Args
- Inherits:
-
Hash
- Object
- Hash
- DTK::Network::Client::Args
- Defined in:
- lib/client/client_args.rb,
lib/client/args.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hash = {}) ⇒ Args
constructor
A new instance of Args.
- #required(key) ⇒ Object
Constructor Details
#initialize(hash = {}) ⇒ Args
Returns a new instance of Args.
4 5 6 |
# File 'lib/client/client_args.rb', line 4 def initialize(hash = {}) replace(hash) end |
Class Method Details
.convert(ruby_hash_or_args) ⇒ Object
8 9 10 |
# File 'lib/client/client_args.rb', line 8 def self.convert(ruby_hash_or_args) ruby_hash_or_args.kind_of?(Args) ? ruby_hash_or_args : new(ruby_hash_or_args) end |
Instance Method Details
#required(key) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/client/client_args.rb', line 12 def required(key) if has_key?(key) self[key] else raise "Args object missing the key '#{key}'" end end |