Class: Opensteam::Helpers::ConfigTableHelper::Column

Inherits:
Object
  • Object
show all
Defined in:
lib/opensteam/helpers/config_table_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, *args) ⇒ Column

Returns a new instance of Column.



100
101
102
103
104
105
106
107
# File 'lib/opensteam/helpers/config_table_helper.rb', line 100

def initialize(id, *args )
  @args = args.is_a?( Array ) ? args.first : args
  @id = id
  @order = @args[:order] || @args[:sql]
  @sql = @args[:sql] || @args[:order]
  @name = @args[:name]
  @method = @args[:method]
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



99
100
101
# File 'lib/opensteam/helpers/config_table_helper.rb', line 99

def id
  @id
end

#nameObject

Returns the value of attribute name.



99
100
101
# File 'lib/opensteam/helpers/config_table_helper.rb', line 99

def name
  @name
end

#orderObject

Returns the value of attribute order.



99
100
101
# File 'lib/opensteam/helpers/config_table_helper.rb', line 99

def order
  @order
end

#sqlObject

Returns the value of attribute sql.



99
100
101
# File 'lib/opensteam/helpers/config_table_helper.rb', line 99

def sql
  @sql
end

Instance Method Details

#sortObject



109
110
111
112
113
114
# File 'lib/opensteam/helpers/config_table_helper.rb', line 109

def sort
  if @method
    return Proc.new { |a,b| a.__send__( @id ).__send__(@method) <=> b.__send__( @id ).__send__( @method ) }
  end
  return @order
end