class Transmission::Arguments
Constants
- ATTRIBUTES
Attributes
arguments[RW]
Public Class Methods
filter(arguments)
click to toggle source
# File lib/transmission/arguments.rb, line 41 def filter(arguments) arguments.inject({}) do |hash, (key, value)| found = self::ATTRIBUTES.select { |attr| attr[:field] == key.to_s } hash[key] = value unless found.empty? hash end end
is_valid?(key)
click to toggle source
# File lib/transmission/arguments.rb, line 33 def is_valid?(key) is_valid_key? key, self::ATTRIBUTES end
new(arguments = nil)
click to toggle source
# File lib/transmission/arguments.rb, line 15 def initialize(arguments = nil) @arguments = arguments.inject({}) do |attributes, (key, value)| key = key.to_s found = self.class::ATTRIBUTES.select { |attr| attr[:field] == key } raise Transmission::Arguments::InvalidArgument, key if found.empty? attributes[key] = value attributes end if arguments @arguments = self.class::ATTRIBUTES if arguments.nil? end
real_key(key)
click to toggle source
# File lib/transmission/arguments.rb, line 37 def real_key(key) option_key key, self::ATTRIBUTES end
Public Instance Methods
to_arguments()
click to toggle source
# File lib/transmission/arguments.rb, line 26 def to_arguments @arguments end