Class: AnnotateRb::ModelAnnotator::ColumnAnnotation::ColumnWrapper
- Inherits:
-
Object
- Object
- AnnotateRb::ModelAnnotator::ColumnAnnotation::ColumnWrapper
- Defined in:
- lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb
Instance Method Summary collapse
- #array? ⇒ Boolean
- #column_type_string ⇒ Object
- #default_function ⇒ Object
- #default_string ⇒ Object
- #default_value ⇒ Object
- #geometric_type ⇒ Object
- #geometric_type? ⇒ Boolean
- #geometry_type ⇒ Object
- #geometry_type? ⇒ Boolean
-
#initialize(column, column_defaults, options) ⇒ ColumnWrapper
constructor
A new instance of ColumnWrapper.
- #limit ⇒ Object
- #name ⇒ Object
- #null ⇒ Object
- #precision ⇒ Object
- #raw_default ⇒ Object
- #scale ⇒ Object
- #sql_type ⇒ Object
- #srid ⇒ Object
- #type ⇒ Object
- #unsigned? ⇒ Boolean
- #virtual? ⇒ Boolean
Constructor Details
#initialize(column, column_defaults, options) ⇒ ColumnWrapper
Returns a new instance of ColumnWrapper.
7 8 9 10 11 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 7 def initialize(column, column_defaults, ) @column = column @column_defaults = column_defaults @options = end |
Instance Method Details
#array? ⇒ Boolean
84 85 86 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 84 def array? @column.respond_to?(:array) && @column.array end |
#column_type_string ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 33 def column_type_string if (@column.respond_to?(:bigint?) && @column.bigint?) || /\Abigint\b/ =~ @column.sql_type "bigint" else (@column.type || @column.sql_type).to_s end end |
#default_function ⇒ Object
96 97 98 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 96 def default_function @column.default_function end |
#default_string ⇒ Object
21 22 23 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 21 def default_string quote(default_value) end |
#default_value ⇒ Object
17 18 19 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 17 def default_value @column_defaults[@column.name] end |
#geometric_type ⇒ Object
74 75 76 77 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 74 def geometric_type # TODO: Check if we need to check if it responds before accessing the geometric type @column.geometric_type end |
#geometric_type? ⇒ Boolean
70 71 72 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 70 def geometric_type? @column.respond_to?(:geometric_type) end |
#geometry_type ⇒ Object
65 66 67 68 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 65 def geometry_type # TODO: Check if we need to check if it responds before accessing the geometry type @column.geometry_type end |
#geometry_type? ⇒ Boolean
61 62 63 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 61 def geometry_type? @column.respond_to?(:geometry_type) end |
#limit ⇒ Object
57 58 59 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 57 def limit @column.limit end |
#name ⇒ Object
88 89 90 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 88 def name @column.name end |
#null ⇒ Object
45 46 47 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 45 def null @column.null end |
#precision ⇒ Object
49 50 51 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 49 def precision @column.precision end |
#raw_default ⇒ Object
13 14 15 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 13 def raw_default @column.default end |
#scale ⇒ Object
53 54 55 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 53 def scale @column.scale end |
#sql_type ⇒ Object
29 30 31 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 29 def sql_type @column.sql_type.to_s end |
#srid ⇒ Object
79 80 81 82 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 79 def srid # TODO: Check if we need to check if it responds before accessing the srid @column.srid end |
#type ⇒ Object
25 26 27 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 25 def type @column.type end |
#unsigned? ⇒ Boolean
41 42 43 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 41 def unsigned? @column.respond_to?(:unsigned?) && @column.unsigned? end |
#virtual? ⇒ Boolean
92 93 94 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 92 def virtual? @column.respond_to?(:virtual?) && @column.virtual? end |