Class: Rgviz::ScalarFunctionColumn
- Inherits:
-
Object
- Object
- Rgviz::ScalarFunctionColumn
- Defined in:
- lib/rgviz/nodes.rb
Constant Summary collapse
- DateDiff =
Token::DateDiff
- Day =
Token::Day
- DayOfWeek =
Token::DayOfWeek
- Difference =
Token::MINUS
- Hour =
Token::Hour
- Lower =
Token::Lower
- Millisecond =
Token::Millisecond
- Minute =
Token::Minute
- Month =
Token::Month
- Now =
Token::Now
- Product =
Token::STAR
- Quarter =
Token::Quarter
- Quotient =
Token::SLASH
- Second =
Token::Second
- Sum =
Token::PLUS
- ToDate =
Token::ToDate
- Upper =
Token::Upper
- Year =
Token::Year
Instance Attribute Summary collapse
-
#arguments ⇒ Object
Returns the value of attribute arguments.
-
#function ⇒ Object
Returns the value of attribute function.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
-
#initialize(function, *arguments) ⇒ ScalarFunctionColumn
constructor
A new instance of ScalarFunctionColumn.
- #to_s ⇒ Object
Constructor Details
#initialize(function, *arguments) ⇒ ScalarFunctionColumn
Returns a new instance of ScalarFunctionColumn.
390 391 392 393 |
# File 'lib/rgviz/nodes.rb', line 390 def initialize(function, *arguments) @function = function @arguments = arguments end |
Instance Attribute Details
#arguments ⇒ Object
Returns the value of attribute arguments.
388 389 390 |
# File 'lib/rgviz/nodes.rb', line 388 def arguments @arguments end |
#function ⇒ Object
Returns the value of attribute function.
387 388 389 |
# File 'lib/rgviz/nodes.rb', line 387 def function @function end |
Instance Method Details
#accept(visitor) ⇒ Object
395 396 397 398 399 400 |
# File 'lib/rgviz/nodes.rb', line 395 def accept(visitor) if visitor.visit_scalar_function_column(self) arguments.each{|x| x.accept visitor} end visitor.end_visit_scalar_function_column self end |
#to_s ⇒ Object
402 403 404 405 406 407 408 409 |
# File 'lib/rgviz/nodes.rb', line 402 def to_s case function when Sum, Difference, Product, Quotient "#{arguments[0].to_s} #{function} #{arguments[1].to_s}" else "#{function}(#{arguments.map(&:to_s).join(', ')})" end end |