Class: Tableficate::Filter::Base
- Inherits:
-
Object
- Object
- Tableficate::Filter::Base
- Defined in:
- lib/tableficate/filters/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#field_name ⇒ Object
readonly
Returns the value of attribute field_name.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#table ⇒ Object
readonly
Returns the value of attribute table.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Instance Method Summary collapse
- #field_value(params) ⇒ Object
-
#initialize(table, name, options = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(table, name, options = {}) ⇒ Base
Returns a new instance of Base.
6 7 8 9 10 11 12 13 14 |
# File 'lib/tableficate/filters/base.rb', line 6 def initialize(table, name, = {}) @table = table @name = name @options = @template = 'filters/' + self.class.name.demodulize.underscore @label = @options.delete(:label) || table.columns.detect{|column| column.name == @name}.try(:header) || name.to_s.titleize @field_name = "#{table.as}[filter][#{@name}]" end |
Instance Attribute Details
#field_name ⇒ Object (readonly)
Returns the value of attribute field_name.
4 5 6 |
# File 'lib/tableficate/filters/base.rb', line 4 def field_name @field_name end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
4 5 6 |
# File 'lib/tableficate/filters/base.rb', line 4 def label @label end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/tableficate/filters/base.rb', line 4 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/tableficate/filters/base.rb', line 4 def @options end |
#table ⇒ Object (readonly)
Returns the value of attribute table.
4 5 6 |
# File 'lib/tableficate/filters/base.rb', line 4 def table @table end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
4 5 6 |
# File 'lib/tableficate/filters/base.rb', line 4 def template @template end |
Instance Method Details
#field_value(params) ⇒ Object
16 17 18 |
# File 'lib/tableficate/filters/base.rb', line 16 def field_value(params) params[:filter][@name] rescue '' end |