Class: Textoken::Options

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

Overview

Creates collection array, checks basic hash format. Responds to collection as an array of options sorted by priority. Does not raise an exception when options are nil

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opt) ⇒ Options

Returns a new instance of Options.



8
9
10
11
12
# File 'lib/textoken/options.rb', line 8

def initialize(opt)
  @options = opt
  @collection = []
  check_options_format
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/textoken/options.rb', line 6

def options
  @options
end

Instance Method Details

#collectionObject



14
15
16
17
18
# File 'lib/textoken/options.rb', line 14

def collection
  options.each { |k, v| init_option(k, v) } if options
  sort_collection
  @collection
end