Class: SQLConstructor::QAttr
- Inherits:
-
Object
- Object
- SQLConstructor::QAttr
- Defined in:
- lib/sqlconstructor.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#no_commas ⇒ Object
readonly
Returns the value of attribute no_commas.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#val ⇒ Object
Returns the value of attribute val.
-
#val_type ⇒ Object
readonly
Returns the value of attribute val_type.
Instance Method Summary collapse
-
#initialize(init_hash = nil) ⇒ QAttr
constructor
A new instance of QAttr.
- #to_s ⇒ Object
Constructor Details
#initialize(init_hash = nil) ⇒ QAttr
198 199 200 201 202 203 204 205 206 207 |
# File 'lib/sqlconstructor.rb', line 198 def initialize ( init_hash = nil ) if init_hash.is_a? Hash @name = init_hash[:name] @text = init_hash[:text] @val = init_hash[:val] @val_type = init_hash[:val_type] @type = init_hash[:type] @no_commas = init_hash[:no_commas] end end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
195 196 197 |
# File 'lib/sqlconstructor.rb', line 195 def name @name end |
#no_commas ⇒ Object (readonly)
Returns the value of attribute no_commas.
195 196 197 |
# File 'lib/sqlconstructor.rb', line 195 def no_commas @no_commas end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
195 196 197 |
# File 'lib/sqlconstructor.rb', line 195 def text @text end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
195 196 197 |
# File 'lib/sqlconstructor.rb', line 195 def type @type end |
#val ⇒ Object
Returns the value of attribute val.
196 197 198 |
# File 'lib/sqlconstructor.rb', line 196 def val @val end |
#val_type ⇒ Object (readonly)
Returns the value of attribute val_type.
195 196 197 |
# File 'lib/sqlconstructor.rb', line 195 def val_type @val_type end |
Instance Method Details
#to_s ⇒ Object
210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/sqlconstructor.rb', line 210 def to_s if [ SQLValList, SQLAliasedList ].include? @val result = @val.to_s else result = @text if @val val_arr = @val.is_a?( Array ) ? @val : [ @val ] result += " " + val_arr.join( "," ) end end return result end |