Class: Rgviz::Sort

Inherits:
Object
  • Object
show all
Defined in:
lib/rgviz/nodes.rb

Constant Summary collapse

Asc =
Token::Asc
Desc =
Token::Desc

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(column, order) ⇒ Sort

Returns a new instance of Sort.



119
120
121
122
# File 'lib/rgviz/nodes.rb', line 119

def initialize(column, order)
  @column = column
  @order = order
end

Instance Attribute Details

#columnObject

Returns the value of attribute column.



116
117
118
# File 'lib/rgviz/nodes.rb', line 116

def column
  @column
end

#orderObject

Returns the value of attribute order.



117
118
119
# File 'lib/rgviz/nodes.rb', line 117

def order
  @order
end

Instance Method Details

#accept(visitor) ⇒ Object



124
125
126
127
128
129
# File 'lib/rgviz/nodes.rb', line 124

def accept(visitor)
  if visitor.visit_sort(self)
    column.accept visitor
  end
  visitor.end_visit_sort self
end

#to_sObject



131
132
133
# File 'lib/rgviz/nodes.rb', line 131

def to_s
  "#{column} #{order}"
end