Class: AnnotateRb::ModelAnnotator::ColumnAnnotation::DefaultValueBuilder
- Inherits:
-
Object
- Object
- AnnotateRb::ModelAnnotator::ColumnAnnotation::DefaultValueBuilder
- Defined in:
- lib/annotate_rb/model_annotator/column_annotation/default_value_builder.rb
Instance Method Summary collapse
-
#build ⇒ String
Returns the value to get written to file by file.puts.
-
#initialize(value, options) ⇒ DefaultValueBuilder
constructor
A new instance of DefaultValueBuilder.
Constructor Details
#initialize(value, options) ⇒ DefaultValueBuilder
Returns a new instance of DefaultValueBuilder.
7 8 9 10 |
# File 'lib/annotate_rb/model_annotator/column_annotation/default_value_builder.rb', line 7 def initialize(value, ) @value = value @options = end |
Instance Method Details
#build ⇒ String
Returns the value to get written to file by file.puts. Strings get written to file so escaped quoted strings get written as quoted. For example, if ‘value: “"some_string"”` then “some_string” gets written. Same with arrays, if `value: “["a", "b", "c"]”` then `[“a”, “b”, “c”]` gets written.
20 21 22 23 24 25 26 |
# File 'lib/annotate_rb/model_annotator/column_annotation/default_value_builder.rb', line 20 def build if @value.is_a?(Array) quote_array(@value) else quote(@value) end end |