class Normalizr::OptionsParser

Attributes

attributes[R]
block[R]
options[R]

Public Class Methods

new(args, block) click to toggle source
# File lib/normalizr/options_parser.rb, line 5
def initialize(args, block)
  @options = Hash === args.last ? args.pop : {}
  @attributes = args
  @block = block
end

Public Instance Methods

after() click to toggle source
# File lib/normalizr/options_parser.rb, line 15
def after
  options_at(:after)
end
before() click to toggle source
# File lib/normalizr/options_parser.rb, line 11
def before
  options_at(:with, :before) { block }
end
negative_condition() click to toggle source
# File lib/normalizr/options_parser.rb, line 23
def negative_condition
  options_at(:unless)
end
positive_condition() click to toggle source
# File lib/normalizr/options_parser.rb, line 19
def positive_condition
  options_at(:if)
end

Private Instance Methods

options_at(*keys) { || ... } click to toggle source
# File lib/normalizr/options_parser.rb, line 29
def options_at(*keys)
  block = yield if block_given?
  [ *options.values_at(*keys), block ].flatten.compact
end