Class: Bricolage::PSQLLoadOptions::Option
- Inherits:
-
Object
- Object
- Bricolage::PSQLLoadOptions::Option
- Defined in:
- lib/bricolage/psqldatasource.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(name, value) ⇒ Option
constructor
A new instance of Option.
-
#to_s ⇒ Object
Make polymorphic?.
Constructor Details
#initialize(name, value) ⇒ Option
Returns a new instance of Option.
494 495 496 497 |
# File 'lib/bricolage/psqldatasource.rb', line 494 def initialize(name, value) @name = name @value = value end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
499 500 501 |
# File 'lib/bricolage/psqldatasource.rb', line 499 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
500 501 502 |
# File 'lib/bricolage/psqldatasource.rb', line 500 def value @value end |
Instance Method Details
#to_s ⇒ Object
Make polymorphic?
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 |
# File 'lib/bricolage/psqldatasource.rb', line 503 def to_s if @name == 'encoding' # encoding utf16le "#{@name} #{@value}" else case @value when true # acceptanydate @name when false # compupdate false "#{@name} false" when 'on', 'off' "#{@name} #{@value}" when String # json 'auto' "#{@name} '#{@value}'" when Integer # maxerror 10 "#{@name} #{@value}" when nil # (explicitly disable boolean options) '' else raise ParameterError, "unsupported option value type for #{@name}: #{@value.inspect}" end end end |