Class: Apiwork::Introspection::Param::String
- Defined in:
- lib/apiwork/introspection/param/string.rb
Overview
String param representing text values.
Instance Method Summary collapse
-
#boundable? ⇒ Boolean
Whether this param is boundable.
-
#concrete? ⇒ Boolean
Whether this param is concrete.
-
#default ⇒ Object?
The default for this param.
-
#enum ⇒ Array<String>, ...
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.
-
#format ⇒ Symbol?
The format for this param.
-
#formattable? ⇒ Boolean
Whether this param is formattable.
-
#max ⇒ Integer?
The maximum for this param.
-
#min ⇒ Integer?
The minimum for this param.
-
#scalar? ⇒ Boolean
Whether this param is scalar.
-
#string? ⇒ Boolean
Whether this param is a string.
-
#to_h ⇒ Hash
Converts this param to a hash.
Methods inherited from Base
#array?, #binary?, #boolean?, #date?, #datetime?, #decimal?, #default?, #deprecated?, #description, #initialize, #integer?, #literal?, #nullable?, #number?, #numeric?, #object?, #optional?, #partial?, #record?, #reference?, #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/string.rb', line 114 def boundable? true end |
#concrete? ⇒ Boolean
Whether this param is concrete.
74 75 76 |
# File 'lib/apiwork/introspection/param/string.rb', line 74 def concrete? 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/string.rb', line 34 def default @dump[:default] end |
#enum ⇒ Array<String>, ...
The enum for this param.
98 99 100 |
# File 'lib/apiwork/introspection/param/string.rb', line 98 def enum @dump[:enum] end |
#enum? ⇒ Boolean
Whether this param has an enum.
90 91 92 |
# File 'lib/apiwork/introspection/param/string.rb', line 90 def enum? @dump[:enum].present? end |
#enum_reference? ⇒ Boolean
Whether this param is an enum reference.
106 107 108 |
# File 'lib/apiwork/introspection/param/string.rb', line 106 def enum_reference? @dump[:enum].is_a?(Symbol) end |
#example ⇒ Object?
The example for this param.
42 43 44 |
# File 'lib/apiwork/introspection/param/string.rb', line 42 def example @dump[:example] end |
#format ⇒ Symbol?
The format for this param.
50 51 52 |
# File 'lib/apiwork/introspection/param/string.rb', line 50 def format @dump[:format] end |
#formattable? ⇒ Boolean
Whether this param is formattable.
122 123 124 |
# File 'lib/apiwork/introspection/param/string.rb', line 122 def formattable? true end |
#max ⇒ Integer?
The maximum for this param.
66 67 68 |
# File 'lib/apiwork/introspection/param/string.rb', line 66 def max @dump[:max] end |
#min ⇒ Integer?
The minimum for this param.
58 59 60 |
# File 'lib/apiwork/introspection/param/string.rb', line 58 def min @dump[:min] end |
#scalar? ⇒ Boolean
Whether this param is scalar.
82 83 84 |
# File 'lib/apiwork/introspection/param/string.rb', line 82 def scalar? true end |
#string? ⇒ Boolean
Whether this param is a string.
130 131 132 |
# File 'lib/apiwork/introspection/param/string.rb', line 130 def string? true end |
#to_h ⇒ Hash
Converts this param to a hash.
138 139 140 141 142 143 144 145 146 147 |
# File 'lib/apiwork/introspection/param/string.rb', line 138 def to_h result = super result[:default] = default result[:enum] = enum if enum? result[:example] = example result[:format] = format result[:max] = max result[:min] = min result end |