Class: Shale::Schema::Compiler::Property Private
- Inherits:
-
Object
- Object
- Shale::Schema::Compiler::Property
- Defined in:
- lib/shale/schema/compiler/property.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Class representing Shale’s property
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attribute_name ⇒ String
readonly
private
Return attribute’s name.
-
#mapping_name ⇒ String
readonly
private
Return mapping’s name.
-
#type ⇒ String
readonly
private
Return types’s name.
Instance Method Summary collapse
-
#collection? ⇒ true, false
private
Return whether property is a collection.
-
#default ⇒ nil, Object
private
Return default value.
-
#initialize(name, type, collection, default) ⇒ Property
constructor
private
Initialize Property object.
Constructor Details
#initialize(name, type, collection, default) ⇒ Property
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize Property object
41 42 43 44 45 46 47 |
# File 'lib/shale/schema/compiler/property.rb', line 41 def initialize(name, type, collection, default) @mapping_name = name @attribute_name = Utils.snake_case(name) @type = type @collection = collection @default = default end |
Instance Attribute Details
#attribute_name ⇒ String (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return attribute’s name
24 25 26 |
# File 'lib/shale/schema/compiler/property.rb', line 24 def attribute_name @attribute_name end |
#mapping_name ⇒ String (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return mapping’s name
17 18 19 |
# File 'lib/shale/schema/compiler/property.rb', line 17 def mapping_name @mapping_name end |
#type ⇒ String (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return types’s name
31 32 33 |
# File 'lib/shale/schema/compiler/property.rb', line 31 def type @type end |
Instance Method Details
#collection? ⇒ true, false
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return whether property is a collection
54 55 56 |
# File 'lib/shale/schema/compiler/property.rb', line 54 def collection? @collection end |
#default ⇒ nil, Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return default value
63 64 65 66 |
# File 'lib/shale/schema/compiler/property.rb', line 63 def default return if collection? @default.is_a?(::String) ? @default.dump : @default end |