Class: Typesafe::Noul
Overview
Instance Attribute Summary collapse
-
#criteria ⇒ Hash?
readonly
The optional
{ true:, false: }descriptions.
Attributes inherited from Question
Instance Method Summary collapse
-
#initialize(instructions, criteria: nil) ⇒ Noul
constructor
A new instance of Noul.
-
#to_h ⇒ Hash
The API shape;
criteriais omitted when not given. - #type ⇒ Object
Methods inherited from Question
Constructor Details
#initialize(instructions, criteria: nil) ⇒ Noul
Returns a new instance of Noul.
20 21 22 23 |
# File 'lib/typesafe/noul.rb', line 20 def initialize(instructions, criteria: nil) @criteria = criteria.nil? ? nil : normalize_criteria(criteria) super(instructions) end |
Instance Attribute Details
#criteria ⇒ Hash? (readonly)
Returns the optional { true:, false: } descriptions.
14 15 16 |
# File 'lib/typesafe/noul.rb', line 14 def criteria @criteria end |
Instance Method Details
#to_h ⇒ Hash
Returns the API shape; criteria is omitted when not given.
30 31 32 |
# File 'lib/typesafe/noul.rb', line 30 def to_h @criteria ? super.merge(criteria: @criteria) : super end |
#type ⇒ Object
25 26 27 |
# File 'lib/typesafe/noul.rb', line 25 def type "noul" end |