Class: Normalizr::OptionsParser

Inherits:
Object
  • Object
show all
Defined in:
lib/normalizr/options_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args, block) ⇒ OptionsParser

Returns a new instance of OptionsParser.



5
6
7
8
9
# File 'lib/normalizr/options_parser.rb', line 5

def initialize(args, block)
  @options = Hash === args.last ? args.pop : {}
  @attributes = args
  @block = block
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



3
4
5
# File 'lib/normalizr/options_parser.rb', line 3

def attributes
  @attributes
end

#blockObject (readonly)

Returns the value of attribute block.



3
4
5
# File 'lib/normalizr/options_parser.rb', line 3

def block
  @block
end

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/normalizr/options_parser.rb', line 3

def options
  @options
end

Instance Method Details

#afterObject



15
16
17
# File 'lib/normalizr/options_parser.rb', line 15

def after
  options_at(:after)
end

#beforeObject



11
12
13
# File 'lib/normalizr/options_parser.rb', line 11

def before
  options_at(:with, :before) { block }
end

#negative_conditionObject



23
24
25
# File 'lib/normalizr/options_parser.rb', line 23

def negative_condition
  options_at(:unless)
end

#positive_conditionObject



19
20
21
# File 'lib/normalizr/options_parser.rb', line 19

def positive_condition
  options_at(:if)
end