Class: Oval::Options

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

[], ensure_equal, it_should, #it_should, validate

Constructor Details

#initialize(decl) ⇒ Options

Returns a new instance of Options.



13
14
15
# File 'lib/oval/options.rb', line 13

def initialize(decl)
  self.decl = decl
end

Instance Attribute Details

#declObject

Returns the value of attribute decl.



17
18
19
# File 'lib/oval/options.rb', line 17

def decl
  @decl
end

Instance Method Details

#validate(options, subject = nil) ⇒ Object



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

def validate(options, subject = nil)
  unless options.is_a?(Hash)
    raise Oval::ValueError,
      "Invalid options #{options.inspect} of type #{options.class.name}. " +
      "Should be a Hash"
  end
  options.each {|name, value| validate_option(name, value, subject) }
end