Class: Gitter::Header
- Inherits:
-
Object
- Object
- Gitter::Header
- Defined in:
- lib/gitter/header.rb
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#grid ⇒ Object
readonly
Returns the value of attribute grid.
-
#html_options ⇒ Object
readonly
Returns the value of attribute html_options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(grid, *args) ⇒ Header
constructor
A new instance of Header.
- #label ⇒ Object
- #link(*args) ⇒ Object
- #name ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(grid, *args) ⇒ Header
Returns a new instance of Header.
10 11 12 13 14 15 16 17 |
# File 'lib/gitter/header.rb', line 10 def initialize grid, *args opts = args. raise ArgumentError, 'too many arguments' if args.size > 1 @grid = grid @content = args.first @column = opts.delete(:column){nil} @html_options = opts end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
8 9 10 |
# File 'lib/gitter/header.rb', line 8 def column @column end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
8 9 10 |
# File 'lib/gitter/header.rb', line 8 def content @content end |
#grid ⇒ Object (readonly)
Returns the value of attribute grid.
8 9 10 |
# File 'lib/gitter/header.rb', line 8 def grid @grid end |
#html_options ⇒ Object (readonly)
Returns the value of attribute html_options.
8 9 10 |
# File 'lib/gitter/header.rb', line 8 def @html_options end |
Class Method Details
.blank ⇒ Object
4 5 6 |
# File 'lib/gitter/header.rb', line 4 def self.blank new :blank, false end |
Instance Method Details
#label ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/gitter/header.rb', line 19 def label @label ||= case content when false then '' when Symbol then grid.translate(:headers, name) else content end end |
#link(*args) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/gitter/header.rb', line 27 def link *args if column column.link label, *args else label end end |
#name ⇒ Object
35 36 37 |
# File 'lib/gitter/header.rb', line 35 def name @name ||= Symbol === content ? content : 'n/a' end |
#to_s ⇒ Object
39 40 41 |
# File 'lib/gitter/header.rb', line 39 def to_s "Header(#{name},html_options=#{},#{column ? ',col':''},label=#{label})" end |