Class: Shale::Attribute Private
- Inherits:
-
Object
- Object
- Shale::Attribute
- Defined in:
- lib/shale/attribute.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 object’s attribute
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
private
Return default.
-
#name ⇒ Object
readonly
private
Return name.
-
#setter ⇒ Object
readonly
private
Return setter name.
-
#type ⇒ Object
readonly
private
Return type.
Instance Method Summary collapse
-
#collection? ⇒ Boolean
private
Return wheter attribute is collection or not.
-
#initialize(name, type, collection, default) ⇒ Attribute
constructor
private
Initialize Attribute object.
Constructor Details
#initialize(name, type, collection, default) ⇒ Attribute
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 Attribute object
36 37 38 39 40 41 42 |
# File 'lib/shale/attribute.rb', line 36 def initialize(name, type, collection, default) @name = name @setter = "#{name}=" @type = type @collection = collection @default = collection ? -> { [] } : default end |
Instance Attribute Details
#default ⇒ Object (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 default
21 22 23 |
# File 'lib/shale/attribute.rb', line 21 def default @default end |
#name ⇒ Object (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 name
11 12 13 |
# File 'lib/shale/attribute.rb', line 11 def name @name end |
#setter ⇒ Object (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 setter name
26 27 28 |
# File 'lib/shale/attribute.rb', line 26 def setter @setter end |
#type ⇒ Object (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 type
16 17 18 |
# File 'lib/shale/attribute.rb', line 16 def type @type end |
Instance Method Details
#collection? ⇒ Boolean
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 wheter attribute is collection or not
49 50 51 |
# File 'lib/shale/attribute.rb', line 49 def collection? @collection == true end |