Class: PgSerializable::Nodes::Attribute
- Defined in:
- lib/pg_serializable/nodes/attribute.rb
Instance Attribute Summary collapse
-
#column_name ⇒ Object
readonly
Returns the value of attribute column_name.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#prc ⇒ Object
readonly
Returns the value of attribute prc.
Instance Method Summary collapse
- #enum? ⇒ Boolean
-
#initialize(klass, column_name, label: nil, &prc) ⇒ Attribute
constructor
A new instance of Attribute.
Methods inherited from Base
Constructor Details
#initialize(klass, column_name, label: nil, &prc) ⇒ Attribute
Returns a new instance of Attribute.
6 7 8 9 10 11 |
# File 'lib/pg_serializable/nodes/attribute.rb', line 6 def initialize(klass, column_name, label: nil, &prc) @klass = klass @column_name = column_name @label = label || column_name @prc = prc if block_given? end |
Instance Attribute Details
#column_name ⇒ Object (readonly)
Returns the value of attribute column_name.
4 5 6 |
# File 'lib/pg_serializable/nodes/attribute.rb', line 4 def column_name @column_name end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
4 5 6 |
# File 'lib/pg_serializable/nodes/attribute.rb', line 4 def klass @klass end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
4 5 6 |
# File 'lib/pg_serializable/nodes/attribute.rb', line 4 def label @label end |
#prc ⇒ Object (readonly)
Returns the value of attribute prc.
4 5 6 |
# File 'lib/pg_serializable/nodes/attribute.rb', line 4 def prc @prc end |
Instance Method Details
#enum? ⇒ Boolean
13 14 15 |
# File 'lib/pg_serializable/nodes/attribute.rb', line 13 def enum? @enum ||= klass.defined_enums.has_key? column_name.to_s end |