Class: Rgviz::ScalarFunctionColumn
- Inherits:
-
Object
- Object
- Rgviz::ScalarFunctionColumn
- Defined in:
- lib/rgviz/nodes.rb
Constant Summary collapse
- Concat =
Token::Concat
- 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
- Round =
Token::Round
- Floor =
Token::Floor
- 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
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ 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.
436 437 438 439 |
# File 'lib/rgviz/nodes.rb', line 436 def initialize(function, *arguments) @function = function @arguments = arguments end |
Instance Attribute Details
#arguments ⇒ Object
Returns the value of attribute arguments.
434 435 436 |
# File 'lib/rgviz/nodes.rb', line 434 def arguments @arguments end |
#function ⇒ Object
Returns the value of attribute function.
433 434 435 |
# File 'lib/rgviz/nodes.rb', line 433 def function @function end |
Instance Method Details
#accept(visitor) ⇒ Object
441 442 443 444 445 446 |
# File 'lib/rgviz/nodes.rb', line 441 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 |
#eql?(other) ⇒ Boolean Also known as: ==
458 459 460 |
# File 'lib/rgviz/nodes.rb', line 458 def eql?(other) other.class == ScalarFunctionColumn && other.function == @function && other.arguments == @arguments end |
#hash ⇒ Object
448 449 450 451 452 453 454 455 456 |
# File 'lib/rgviz/nodes.rb', line 448 def hash return @hash if @hash @hash = 1 @hash = @hash * 31 + @function.hash @arguments.each do |arg| @hash = @hash * 31 + arg.hash end @hash end |
#to_s ⇒ Object
464 465 466 467 468 469 470 471 |
# File 'lib/rgviz/nodes.rb', line 464 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 |