Class: Render::Attribute
- Inherits:
-
Object
- Object
- Render::Attribute
- Defined in:
- lib/render/attributes/attribute.rb
Direct Known Subclasses
Constant Summary collapse
- SCHEMA_IDENTIFIERS =
[:properties, :items].freeze
Instance Attribute Summary collapse
-
#default ⇒ Object
writeonly
Sets the attribute default.
-
#enums ⇒ Object
Returns the value of attribute enums.
-
#exclusive_maximum ⇒ Object
Returns the value of attribute exclusive_maximum.
-
#exclusive_minimum ⇒ Object
Returns the value of attribute exclusive_minimum.
-
#format ⇒ Object
Returns the value of attribute format.
-
#max_length ⇒ Object
Returns the value of attribute max_length.
-
#maximum ⇒ Object
Returns the value of attribute maximum.
-
#min_length ⇒ Object
Returns the value of attribute min_length.
-
#minimum ⇒ Object
Returns the value of attribute minimum.
-
#multiple_of ⇒ Object
Returns the value of attribute multiple_of.
-
#name ⇒ Object
Returns the value of attribute name.
-
#schema ⇒ Object
Returns the value of attribute schema.
-
#types ⇒ Object
Returns the value of attribute types.
Instance Method Summary collapse
- #bias_type ⇒ Object
- #default_value ⇒ Object
-
#initialize(options = {}) ⇒ Attribute
constructor
A new instance of Attribute.
- #nested_schema?(options = {}) ⇒ Boolean
Constructor Details
Instance Attribute Details
#default=(value) ⇒ Object (writeonly)
Sets the attribute default
20 21 22 |
# File 'lib/render/attributes/attribute.rb', line 20 def default=(value) @default = value end |
#enums ⇒ Object
Returns the value of attribute enums.
7 8 9 |
# File 'lib/render/attributes/attribute.rb', line 7 def enums @enums end |
#exclusive_maximum ⇒ Object
Returns the value of attribute exclusive_maximum.
7 8 9 |
# File 'lib/render/attributes/attribute.rb', line 7 def exclusive_maximum @exclusive_maximum end |
#exclusive_minimum ⇒ Object
Returns the value of attribute exclusive_minimum.
7 8 9 |
# File 'lib/render/attributes/attribute.rb', line 7 def exclusive_minimum @exclusive_minimum end |
#format ⇒ Object
Returns the value of attribute format.
7 8 9 |
# File 'lib/render/attributes/attribute.rb', line 7 def format @format end |
#max_length ⇒ Object
Returns the value of attribute max_length.
7 8 9 |
# File 'lib/render/attributes/attribute.rb', line 7 def max_length @max_length end |
#maximum ⇒ Object
Returns the value of attribute maximum.
7 8 9 |
# File 'lib/render/attributes/attribute.rb', line 7 def maximum @maximum end |
#min_length ⇒ Object
Returns the value of attribute min_length.
7 8 9 |
# File 'lib/render/attributes/attribute.rb', line 7 def min_length @min_length end |
#minimum ⇒ Object
Returns the value of attribute minimum.
7 8 9 |
# File 'lib/render/attributes/attribute.rb', line 7 def minimum @minimum end |
#multiple_of ⇒ Object
Returns the value of attribute multiple_of.
7 8 9 |
# File 'lib/render/attributes/attribute.rb', line 7 def multiple_of @multiple_of end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/render/attributes/attribute.rb', line 7 def name @name end |
#schema ⇒ Object
Returns the value of attribute schema.
7 8 9 |
# File 'lib/render/attributes/attribute.rb', line 7 def schema @schema end |
#types ⇒ Object
Returns the value of attribute types.
7 8 9 |
# File 'lib/render/attributes/attribute.rb', line 7 def types @types end |
Instance Method Details
#bias_type ⇒ Object
26 27 28 |
# File 'lib/render/attributes/attribute.rb', line 26 def bias_type format || types.first end |
#default_value ⇒ Object
30 31 32 |
# File 'lib/render/attributes/attribute.rb', line 30 def default_value @default || (Render.live ? nil : faux_value) end |
#nested_schema?(options = {}) ⇒ Boolean
34 35 36 |
# File 'lib/render/attributes/attribute.rb', line 34 def nested_schema?( = {}) .any? { |name, value| SCHEMA_IDENTIFIERS.include?(name) } end |