Class: ActiveRecord::Comments::ConnectionAdapters::CommentDefinition
- Inherits:
-
Struct
- Object
- Struct
- ActiveRecord::Comments::ConnectionAdapters::CommentDefinition
- Defined in:
- lib/active_record/comments/connection_adapters/comment_definition.rb
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#column_name ⇒ Object
Returns the value of attribute column_name.
-
#comment_text ⇒ Object
Returns the value of attribute comment_text.
-
#table ⇒ Object
Returns the value of attribute table.
Instance Method Summary collapse
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter
2 3 4 |
# File 'lib/active_record/comments/connection_adapters/comment_definition.rb', line 2 def adapter @adapter end |
#column_name ⇒ Object
Returns the value of attribute column_name
2 3 4 |
# File 'lib/active_record/comments/connection_adapters/comment_definition.rb', line 2 def column_name @column_name end |
#comment_text ⇒ Object
Returns the value of attribute comment_text
2 3 4 |
# File 'lib/active_record/comments/connection_adapters/comment_definition.rb', line 2 def comment_text @comment_text end |
#table ⇒ Object
Returns the value of attribute table
2 3 4 |
# File 'lib/active_record/comments/connection_adapters/comment_definition.rb', line 2 def table @table end |
Instance Method Details
#table_comment? ⇒ Boolean
16 17 18 |
# File 'lib/active_record/comments/connection_adapters/comment_definition.rb', line 16 def table_comment? column_name.blank? end |
#table_name ⇒ Object
20 21 22 |
# File 'lib/active_record/comments/connection_adapters/comment_definition.rb', line 20 def table_name table.respond_to?(:name) ? table.name : table end |
#to_dump ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/active_record/comments/connection_adapters/comment_definition.rb', line 3 def to_dump if table_comment? "set_table_comment :#{table_name}, %{#{comment_text}}" else "set_column_comment :#{table_name}, :#{column_name}, %{#{comment_text}}" end end |
#to_sql ⇒ Object Also known as: to_s
11 12 13 |
# File 'lib/active_record/comments/connection_adapters/comment_definition.rb', line 11 def to_sql adapter.comment_sql(self) end |