Class: Clowne::Utils::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/clowne/utils/options.rb

Constant Summary collapse

INTERNAL_KEYS =
%i[adapter traits clowne_only_actions mapping only].freeze

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Options

Returns a new instance of Options.



8
9
10
# File 'lib/clowne/utils/options.rb', line 8

def initialize(options)
  @options = options
end

Instance Method Details

#adapterObject



24
25
26
# File 'lib/clowne/utils/options.rb', line 24

def adapter
  options[:adapter]
end

#mapperObject



20
21
22
# File 'lib/clowne/utils/options.rb', line 20

def mapper
  options[:mapper]
end

#onlyObject



16
17
18
# File 'lib/clowne/utils/options.rb', line 16

def only
  options[:clowne_only_actions]
end

#paramsObject



28
29
30
31
32
# File 'lib/clowne/utils/options.rb', line 28

def params
  options.dup.tap do |o|
    INTERNAL_KEYS.each { |key| o.delete(key) }
  end
end

#traitsObject



12
13
14
# File 'lib/clowne/utils/options.rb', line 12

def traits
  @_traits ||= Array(options[:traits])
end