Class: Alexandria::UI::CompletionModels
- Inherits:
-
Object
- Object
- Alexandria::UI::CompletionModels
- Includes:
- Singleton
- Defined in:
- lib/alexandria/ui/completion_models.rb
Instance Method Summary collapse
- #add_source(library) ⇒ Object
- #author_model ⇒ Object
- #borrower_model ⇒ Object
- #edition_model ⇒ Object
-
#initialize ⇒ CompletionModels
constructor
A new instance of CompletionModels.
- #models ⇒ Object
- #publisher_model ⇒ Object
- #remove_source(library) ⇒ Object
- #tag_model ⇒ Object
- #title_model ⇒ Object
- #update(_library, _kind, _book) ⇒ Object
Constructor Details
#initialize ⇒ CompletionModels
Returns a new instance of CompletionModels.
78 79 80 81 82 83 84 |
# File 'lib/alexandria/ui/completion_models.rb', line 78 def initialize @models = [] @libraries = [] 5.times { @models << Gtk::ListStore.new(String) } @models << Gtk::ListStore.new(String) touch end |
Instance Method Details
#add_source(library) ⇒ Object
86 87 88 89 90 |
# File 'lib/alexandria/ui/completion_models.rb', line 86 def add_source(library) @libraries << library library.add_observer(self) touch end |
#author_model ⇒ Object
113 114 115 116 |
# File 'lib/alexandria/ui/completion_models.rb', line 113 def rebuild_models if dirty? @models[AUTHOR] end |
#borrower_model ⇒ Object
128 129 130 131 |
# File 'lib/alexandria/ui/completion_models.rb', line 128 def borrower_model rebuilds_models if dirty? @models[BORROWER] end |
#edition_model ⇒ Object
123 124 125 126 |
# File 'lib/alexandria/ui/completion_models.rb', line 123 def edition_model rebuild_models if dirty? @models[EDITION] end |
#models ⇒ Object
103 104 105 106 |
# File 'lib/alexandria/ui/completion_models.rb', line 103 def models rebuild_models if dirty? @models end |
#publisher_model ⇒ Object
118 119 120 121 |
# File 'lib/alexandria/ui/completion_models.rb', line 118 def publisher_model rebuild_models if dirty? @models[PUBLISHER] end |
#remove_source(library) ⇒ Object
92 93 94 95 96 |
# File 'lib/alexandria/ui/completion_models.rb', line 92 def remove_source(library) @libraries.delete_if { |x| x.name == library.name } library.delete_observer(self) touch end |
#tag_model ⇒ Object
133 134 135 136 |
# File 'lib/alexandria/ui/completion_models.rb', line 133 def tag_model rebuilds_models if dirty? @models[TAG] end |
#title_model ⇒ Object
108 109 110 111 |
# File 'lib/alexandria/ui/completion_models.rb', line 108 def title_model rebuild_models if dirty? @models[TITLE] end |
#update(_library, _kind, _book) ⇒ Object
98 99 100 101 |
# File 'lib/alexandria/ui/completion_models.rb', line 98 def update(_library, _kind, _book) # FIXME: Do not rebuild all the models there. touch end |