Class: Apiwork::Introspection::Param::Decimal
- Defined in:
- lib/apiwork/introspection/param/decimal.rb
Overview
Decimal param representing precise decimal number values.
Instance Method Summary collapse
-
#boundable? ⇒ Boolean
Whether this param is boundable.
-
#concrete? ⇒ Boolean
Whether this param is concrete.
-
#decimal? ⇒ Boolean
Whether this param is a decimal.
-
#default ⇒ Object?
The default for this param.
-
#enum ⇒ Array<Numeric>, ...
The enum for this param.
-
#enum? ⇒ Boolean
Whether this param has an enum.
-
#enum_reference? ⇒ Boolean
Whether this param is an enum reference.
-
#example ⇒ Object?
The example for this param.
-
#formattable? ⇒ Boolean
Whether this param is formattable.
-
#max ⇒ Numeric?
The maximum for this param.
-
#min ⇒ Numeric?
The minimum for this param.
-
#numeric? ⇒ Boolean
Whether this param is numeric.
-
#scalar? ⇒ Boolean
Whether this param is scalar.
-
#to_h ⇒ Hash
Converts this param to a hash.
Methods inherited from Base
#array?, #binary?, #boolean?, #date?, #datetime?, #default?, #deprecated?, #description, #initialize, #integer?, #literal?, #nullable?, #number?, #object?, #optional?, #partial?, #record?, #reference?, #string?, #tag, #time?, #type, #union?, #unknown?, #uuid?
Constructor Details
This class inherits a constructor from Apiwork::Introspection::Param::Base
Instance Method Details
#boundable? ⇒ Boolean
Whether this param is boundable.
114 115 116 |
# File 'lib/apiwork/introspection/param/decimal.rb', line 114 def boundable? true end |
#concrete? ⇒ Boolean
Whether this param is concrete.
66 67 68 |
# File 'lib/apiwork/introspection/param/decimal.rb', line 66 def concrete? true end |
#decimal? ⇒ Boolean
Whether this param is a decimal.
122 123 124 |
# File 'lib/apiwork/introspection/param/decimal.rb', line 122 def decimal? true end |
#default ⇒ Object?
The default for this param.
Returns ‘nil` for both “no default” and “default is explicitly `nil`”. Use Base#default? to distinguish these cases.
34 35 36 |
# File 'lib/apiwork/introspection/param/decimal.rb', line 34 def default @dump[:default] end |
#enum ⇒ Array<Numeric>, ...
The enum for this param.
90 91 92 |
# File 'lib/apiwork/introspection/param/decimal.rb', line 90 def enum @dump[:enum] end |
#enum? ⇒ Boolean
Whether this param has an enum.
82 83 84 |
# File 'lib/apiwork/introspection/param/decimal.rb', line 82 def enum? @dump[:enum].present? end |
#enum_reference? ⇒ Boolean
Whether this param is an enum reference.
98 99 100 |
# File 'lib/apiwork/introspection/param/decimal.rb', line 98 def enum_reference? @dump[:enum].is_a?(Symbol) end |
#example ⇒ Object?
The example for this param.
42 43 44 |
# File 'lib/apiwork/introspection/param/decimal.rb', line 42 def example @dump[:example] end |
#formattable? ⇒ Boolean
Whether this param is formattable.
130 131 132 |
# File 'lib/apiwork/introspection/param/decimal.rb', line 130 def formattable? false end |
#max ⇒ Numeric?
The maximum for this param.
58 59 60 |
# File 'lib/apiwork/introspection/param/decimal.rb', line 58 def max @dump[:max] end |
#min ⇒ Numeric?
The minimum for this param.
50 51 52 |
# File 'lib/apiwork/introspection/param/decimal.rb', line 50 def min @dump[:min] end |
#numeric? ⇒ Boolean
Whether this param is numeric.
106 107 108 |
# File 'lib/apiwork/introspection/param/decimal.rb', line 106 def numeric? true end |
#scalar? ⇒ Boolean
Whether this param is scalar.
74 75 76 |
# File 'lib/apiwork/introspection/param/decimal.rb', line 74 def scalar? true end |
#to_h ⇒ Hash
Converts this param to a hash.
138 139 140 141 142 143 144 145 146 |
# File 'lib/apiwork/introspection/param/decimal.rb', line 138 def to_h result = super result[:default] = default result[:enum] = enum if enum? result[:example] = example result[:max] = max result[:min] = min result end |