Class: Tag::Runner
- Inherits:
-
Thor
- Object
- Thor
- Tag::Runner
- Defined in:
- lib/tag/runner.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add(*items) ⇒ Object
- #list(tag) ⇒ Object
- #models ⇒ Object
- #rm(*items) ⇒ Object
- #tags(*args) ⇒ Object
- #tree ⇒ Object
Class Method Details
.model_option ⇒ Object
5 6 7 |
# File 'lib/tag/runner.rb', line 5 def self.model_option method_option :model, :type => :string, :aliases => '-m' end |
Instance Method Details
#add(*items) ⇒ Object
12 13 14 |
# File 'lib/tag/runner.rb', line 12 def add(*items) Tag.store([:model]).multi_tag(items, [:tags]) end |
#list(tag) ⇒ Object
25 26 27 |
# File 'lib/tag/runner.rb', line 25 def list(tag) puts Tag.store([:model]).list(tag) end |
#models ⇒ Object
47 48 49 |
# File 'lib/tag/runner.rb', line 47 def models puts Tag::Store.models end |
#rm(*items) ⇒ Object
19 20 21 |
# File 'lib/tag/runner.rb', line 19 def rm(*items) Tag.store([:model]).multi_remove_tag(items, [:tags]) end |
#tags(*args) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/tag/runner.rb', line 32 def (*args) if [:rm] Tag.store([:model]).(*args) else puts Tag.store([:model]). end end |
#tree ⇒ Object
42 43 44 |
# File 'lib/tag/runner.rb', line 42 def tree puts Tag.store([:model]).tree end |