Module: Attributor::Numeric::ClassMethods
- Defined in:
- lib/attributor/families/numeric.rb
Instance Method Summary collapse
- #as_json_schema(shallow: false, example: nil, attribute_options: {}) ⇒ Object
- #family ⇒ Object
- #native_type ⇒ Object
Instance Method Details
#as_json_schema(shallow: false, example: nil, attribute_options: {}) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/attributor/families/numeric.rb', line 18 def as_json_schema( shallow: false, example: nil, attribute_options: {} ) h = super opts = ( self.respond_to?(:options) ) ? self..merge( ) : h[:minimum] = opts[:min] if opts[:min] h[:maximum] = opts[:max] if opts[:max] # We're not explicitly setting false to exclusiveMinimum and exclusiveMaximum (as that's the default) h end |
#family ⇒ Object
14 15 16 |
# File 'lib/attributor/families/numeric.rb', line 14 def family 'numeric' end |
#native_type ⇒ Object
10 11 12 |
# File 'lib/attributor/families/numeric.rb', line 10 def native_type raise NotImplementedError end |