Class: Gate::Configuration
- Inherits:
-
Object
- Object
- Gate::Configuration
- Extended by:
- Forwardable
- Defined in:
- lib/gate/configuration.rb
Instance Attribute Summary collapse
-
#coercer ⇒ Object
readonly
Returns the value of attribute coercer.
-
#nested_set ⇒ Object
readonly
Returns the value of attribute nested_set.
-
#optional_set ⇒ Object
readonly
Returns the value of attribute optional_set.
-
#required_set ⇒ Object
readonly
Returns the value of attribute required_set.
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
Instance Method Summary collapse
- #allow_nil? ⇒ Boolean
-
#initialize(coercer: Coercible::Coercer.new, allow_nil: false, &block) ⇒ Configuration
constructor
A new instance of Configuration.
- #required?(name) ⇒ Boolean
Constructor Details
#initialize(coercer: Coercible::Coercer.new, allow_nil: false, &block) ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/gate/configuration.rb', line 11 def initialize(coercer: Coercible::Coercer.new, allow_nil: false, &block) @coercer = coercer @required_set = Set.new @optional_set = Set.new @nested_set = Set.new @rules = {} @allow_nil = allow_nil instance_eval(&block) end |
Instance Attribute Details
#coercer ⇒ Object (readonly)
Returns the value of attribute coercer.
5 6 7 |
# File 'lib/gate/configuration.rb', line 5 def coercer @coercer end |
#nested_set ⇒ Object (readonly)
Returns the value of attribute nested_set.
6 7 8 |
# File 'lib/gate/configuration.rb', line 6 def nested_set @nested_set end |
#optional_set ⇒ Object (readonly)
Returns the value of attribute optional_set.
6 7 8 |
# File 'lib/gate/configuration.rb', line 6 def optional_set @optional_set end |
#required_set ⇒ Object (readonly)
Returns the value of attribute required_set.
6 7 8 |
# File 'lib/gate/configuration.rb', line 6 def required_set @required_set end |
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
7 8 9 |
# File 'lib/gate/configuration.rb', line 7 def rules @rules end |
Instance Method Details
#allow_nil? ⇒ Boolean
26 27 28 |
# File 'lib/gate/configuration.rb', line 26 def allow_nil? @allow_nil end |
#required?(name) ⇒ Boolean
22 23 24 |
# File 'lib/gate/configuration.rb', line 22 def required?(name) required_set.include?(name) end |