Class: NormalizeOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/service_api/normalize_options.rb,
lib/service_api/normalize_options/base.rb,
lib/service_api/normalize_options/hash_with_mapper_hash.rb,
lib/service_api/normalize_options/normal_with_mapper_hash.rb,
lib/service_api/normalize_options/normal_with_mapper_array.rb

Defined Under Namespace

Classes: Base, HashWithMapperHash, NormalWithMapperArray, NormalWithMapperHash

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mapper, *options) ⇒ NormalizeOptions

Returns a new instance of NormalizeOptions.



9
10
11
12
# File 'lib/service_api/normalize_options.rb', line 9

def initialize(mapper, *options)
  @mapper = mapper
  @options = options
end

Instance Attribute Details

#mapperObject (readonly)

Returns the value of attribute mapper.



7
8
9
# File 'lib/service_api/normalize_options.rb', line 7

def mapper
  @mapper
end

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/service_api/normalize_options.rb', line 7

def options
  @options
end

Instance Method Details

#callObject



14
15
16
17
18
19
20
21
22
# File 'lib/service_api/normalize_options.rb', line 14

def call
  if hash_options?
    parse_hash_options
  elsif arguments_count_corrent?
    parse_normal_options
  else
    raise ArgumentError
  end
end