class Tag::Runner

Public Class Methods

model_option() click to toggle source
# File lib/tag/runner.rb, line 5
def self.model_option
  option :model, :type => :string
end

Public Instance Methods

add(*items) click to toggle source
# File lib/tag/runner.rb, line 12
def add(*items)
  options = items[-1].is_a?(Hash) ? items.pop : {}
  Tag.store(options[:model]).multi_tag(items, options[:tags])
end
items() click to toggle source
# File lib/tag/runner.rb, line 55
def items
  puts Tag.store.items
end
list(tag, options={}) click to toggle source
# File lib/tag/runner.rb, line 27
def list(tag, options={})
  puts Tag.store(options[:model]).list(tag)
end
models() click to toggle source
# File lib/tag/runner.rb, line 50
def models
  puts Tag::Store.models
end
rm(*items) click to toggle source
# File lib/tag/runner.rb, line 20
def rm(*items)
  options = items[-1].is_a?(Hash) ? items.pop : {}
  Tag.store(options[:model]).multi_remove_tag(items, options[:tags])
end
tags(*args) click to toggle source
# File lib/tag/runner.rb, line 34
def tags(*args)
  options = args[-1].is_a?(Hash) ? args.pop : {}
  if options[:rm]
    Tag.store(options[:model]).delete_tags(*args)
  else
    puts Tag.store(options[:model]).list_tags
  end
end
tree(options={}) click to toggle source
# File lib/tag/runner.rb, line 45
def tree(options={})
  puts Tag.store(options[:model]).tree
end