Class: Sus::RespondTo::WithOptions
- Inherits:
-
Object
- Object
- Sus::RespondTo::WithOptions
- Defined in:
- lib/sus/respond_to.rb
Instance Method Summary collapse
- #call(assertions, subject) ⇒ Object
-
#initialize(options) ⇒ WithOptions
constructor
A new instance of WithOptions.
- #print(output) ⇒ Object
Constructor Details
#initialize(options) ⇒ WithOptions
Returns a new instance of WithOptions.
36 37 38 |
# File 'lib/sus/respond_to.rb', line 36 def initialize() @options = end |
Instance Method Details
#call(assertions, subject) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/sus/respond_to.rb', line 44 def call(assertions, subject) = {} @options.each{|name| [name] = nil} subject.each do |type, name| [name] = type end assertions.nested(self) do |assertions| .each do |name, type| assertions.assert(type != nil, "option #{name}: is required") end end end |
#print(output) ⇒ Object
40 41 42 |
# File 'lib/sus/respond_to.rb', line 40 def print(output) output.write("with options ", :variable, @options.inspect) end |