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
-
#enums ⇒ Object
Returns the value of attribute enums.
-
#format ⇒ Object
Returns the value of attribute format.
-
#name ⇒ Object
Returns the value of attribute name.
-
#required ⇒ Object
Returns the value of attribute required.
-
#schema ⇒ Object
Returns the value of attribute schema.
-
#type ⇒ Object
Returns the value of attribute type.
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
#enums ⇒ Object
Returns the value of attribute enums.
7 8 9 |
# File 'lib/render/attributes/attribute.rb', line 7 def enums @enums end |
#format ⇒ Object
Returns the value of attribute format.
7 8 9 |
# File 'lib/render/attributes/attribute.rb', line 7 def format @format end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/render/attributes/attribute.rb', line 7 def name @name end |
#required ⇒ Object
Returns the value of attribute required.
7 8 9 |
# File 'lib/render/attributes/attribute.rb', line 7 def required @required end |
#schema ⇒ Object
Returns the value of attribute schema.
7 8 9 |
# File 'lib/render/attributes/attribute.rb', line 7 def schema @schema end |
#type ⇒ Object
Returns the value of attribute type.
7 8 9 |
# File 'lib/render/attributes/attribute.rb', line 7 def type @type end |
Instance Method Details
#bias_type ⇒ Object
19 20 21 |
# File 'lib/render/attributes/attribute.rb', line 19 def bias_type format || type end |
#default_value ⇒ Object
23 24 25 |
# File 'lib/render/attributes/attribute.rb', line 23 def default_value Render.live ? nil : faux_value end |
#nested_schema?(options = {}) ⇒ Boolean
27 28 29 |
# File 'lib/render/attributes/attribute.rb', line 27 def nested_schema?( = {}) .any? { |name, value| SCHEMA_IDENTIFIERS.include?(name) } end |