Class: BB::Converter::Value
- Inherits:
-
Object
- Object
- BB::Converter::Value
- Defined in:
- lib/b_b/converter/value.rb
Constant Summary collapse
- TEMPLATE =
{ array: "(%s)", date: "DATE('%Y-%m-%d')", null: "NULL", range: "%s AND %s", regexp: "r'%s'", string: "'%s'", subquery: "(%s)", time: "TIMESTAMP('%Y-%m-%d %H:%M:%S')", timestamp: "TIMESTAMP('%Y-%m-%d')" }.freeze
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #convert ⇒ Object
-
#initialize(value, options = {}) ⇒ Value
constructor
A new instance of Value.
Constructor Details
#initialize(value, options = {}) ⇒ Value
Returns a new instance of Value.
18 19 20 21 22 |
# File 'lib/b_b/converter/value.rb', line 18 def initialize(value, = {}) @value = value @options = @type = format_type end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
16 17 18 |
# File 'lib/b_b/converter/value.rb', line 16 def @options end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
16 17 18 |
# File 'lib/b_b/converter/value.rb', line 16 def type @type end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
16 17 18 |
# File 'lib/b_b/converter/value.rb', line 16 def value @value end |
Class Method Details
.convert(value, options = {}) ⇒ Object
93 94 95 |
# File 'lib/b_b/converter/value.rb', line 93 def convert(value, = {}) new(value, ).convert end |
Instance Method Details
#convert ⇒ Object
24 25 26 |
# File 'lib/b_b/converter/value.rb', line 24 def convert send("to_#{type}") end |