Class: Kang::Tags
- Inherits:
-
Object
- Object
- Kang::Tags
- Defined in:
- lib/kang/tags.rb
Instance Method Summary collapse
- #[](i) ⇒ Object
-
#initialize(view) ⇒ Tags
constructor
A new instance of Tags.
Constructor Details
Instance Method Details
#[](i) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/kang/tags.rb', line 23 def[](i) tag = nil begin tag_name = "color#{i}" tag = @tags.fetch(tag_name) rescue KeyError c = @colors[i] color = Gdk::Color.new(*c) tag = Gtk::TextTag.new(tag_name) tag.foreground='black' tag.background_gdk=color @tags[tag_name] = tag @view.buffer.tag_table.add(tag) end tag end |