Class: Logsaber::Options

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/logsaber/options.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extract_from(args, defaults = {}, primary = nil) ⇒ Object


5
6
7
8
9
10
# File 'lib/logsaber/options.rb', line 5

def self.extract_from args, defaults = {}, primary = nil
  options = args.last.is_a?(Hash) ? args.pop : Hash.new
  options[primary] = args.shift if primary && args.first

  new defaults.merge(options)
end

Instance Method Details

#to_aObject Also known as: to_ary


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

def to_a
  @table.values
end