Class: Qadmin::OptionSet

Inherits:
Array
  • Object
show all
Defined in:
lib/qadmin/option_set.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ OptionSet

Returns a new instance of OptionSet.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/qadmin/option_set.rb', line 4

def initialize(*args)
  first = args.shift
  if first.is_a?(Array)
    self.default = first 
    options = args.shift
  else
    options = first
  end
  if options.is_a?(Hash)
    options.each do |option, value|
      self.send("#{option}=", value)
    end
  end
end

Instance Method Details

#currentObject



19
20
21
# File 'lib/qadmin/option_set.rb', line 19

def current
  [self].flatten.dup
end