Class: Jquard::Tables::Columns::Column
- Inherits:
-
Object
- Object
- Jquard::Tables::Columns::Column
- Includes:
- ComponentDispatch
- Defined in:
- lib/jquard/tables/columns/column.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name) ⇒ Column
constructor
A new instance of Column.
- #label(value = nil) ⇒ Object
- #searchable(value = true) ⇒ Object
- #searchable? ⇒ Boolean
- #sortable(value = true) ⇒ Object
- #sortable? ⇒ Boolean
- #state_for(record) ⇒ Object
Methods included from ComponentDispatch
Constructor Details
#initialize(name) ⇒ Column
Returns a new instance of Column.
13 14 15 |
# File 'lib/jquard/tables/columns/column.rb', line 13 def initialize(name) @name = name.to_sym end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/jquard/tables/columns/column.rb', line 7 def name @name end |
Class Method Details
.make(name) ⇒ Object
9 10 11 |
# File 'lib/jquard/tables/columns/column.rb', line 9 def self.make(name) new(name) end |
Instance Method Details
#label(value = nil) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/jquard/tables/columns/column.rb', line 17 def label(value = nil) return @label || name.to_s.humanize if value.nil? @label = value self end |
#searchable(value = true) ⇒ Object
24 25 26 27 |
# File 'lib/jquard/tables/columns/column.rb', line 24 def searchable(value = true) @searchable = value self end |
#searchable? ⇒ Boolean
29 30 31 |
# File 'lib/jquard/tables/columns/column.rb', line 29 def searchable? !!@searchable end |
#sortable(value = true) ⇒ Object
33 34 35 36 |
# File 'lib/jquard/tables/columns/column.rb', line 33 def sortable(value = true) @sortable = value self end |
#sortable? ⇒ Boolean
38 39 40 |
# File 'lib/jquard/tables/columns/column.rb', line 38 def sortable? !!@sortable end |
#state_for(record) ⇒ Object
42 43 44 |
# File 'lib/jquard/tables/columns/column.rb', line 42 def state_for(record) record.public_send(name) end |