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_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
- #srid ⇒ Object
- #type ⇒ Object
- #unsigned? ⇒ 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
80 81 82 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 80 def array? @column.respond_to?(:array) && @column.array end |
#column_type_string ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 29 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_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
70 71 72 73 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 70 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
66 67 68 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 66 def geometric_type? @column.respond_to?(:geometric_type) end |
#geometry_type ⇒ Object
61 62 63 64 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 61 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
57 58 59 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 57 def geometry_type? @column.respond_to?(:geometry_type) end |
#limit ⇒ Object
53 54 55 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 53 def limit @column.limit end |
#name ⇒ Object
84 85 86 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 84 def name @column.name end |
#null ⇒ Object
41 42 43 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 41 def null @column.null end |
#precision ⇒ Object
45 46 47 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 45 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
49 50 51 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 49 def scale @column.scale end |
#srid ⇒ Object
75 76 77 78 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 75 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
37 38 39 |
# File 'lib/annotate_rb/model_annotator/column_annotation/column_wrapper.rb', line 37 def unsigned? @column.respond_to?(:unsigned?) && @column.unsigned? end |