Class: Tag::Runner

Inherits:
Thor
  • Object
show all
Defined in:
lib/tag/runner.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.model_optionObject



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(options[:model]).multi_tag(items, options[:tags])
end

#list(tag) ⇒ Object



25
26
27
# File 'lib/tag/runner.rb', line 25

def list(tag)
  puts Tag.store(options[:model]).list(tag)
end

#modelsObject



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(options[:model]).multi_remove_tag(items, options[:tags])
end

#tags(*args) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/tag/runner.rb', line 32

def tags(*args)
  if options[:rm]
    Tag.store(options[:model]).delete_tags(*args)
  else
    puts Tag.store(options[:model]).list_tags
  end
end

#treeObject



42
43
44
# File 'lib/tag/runner.rb', line 42

def tree
  puts Tag.store(options[:model]).tree
end