Class: Opensteam::Helpers::ConfigTableHelper::Column
- Inherits:
-
Object
- Object
- Opensteam::Helpers::ConfigTableHelper::Column
- Defined in:
- lib/opensteam/helpers/config_table_helper.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#order ⇒ Object
Returns the value of attribute order.
-
#sql ⇒ Object
Returns the value of attribute sql.
Instance Method Summary collapse
-
#initialize(id, *args) ⇒ Column
constructor
A new instance of Column.
- #sort ⇒ Object
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
#id ⇒ Object
Returns the value of attribute id.
99 100 101 |
# File 'lib/opensteam/helpers/config_table_helper.rb', line 99 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
99 100 101 |
# File 'lib/opensteam/helpers/config_table_helper.rb', line 99 def name @name end |
#order ⇒ Object
Returns the value of attribute order.
99 100 101 |
# File 'lib/opensteam/helpers/config_table_helper.rb', line 99 def order @order end |
#sql ⇒ Object
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
#sort ⇒ Object
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 |