module Openmeta
Constants
- VERSION
Attributes
error[W]
ui[W]
Public Class Methods
clear(files)
click to toggle source
# File lib/openmeta/macruby.rb, line 113 def clear(files) files = fu_list(files) files.each { |file| set_tags([], file) set_rating(0.0, file) } end
clone(from_file, to_files)
click to toggle source
# File lib/openmeta/macruby.rb, line 97 def clone(from_file, to_files) unless File.exist?(from_file) raise Openmeta::PathError, "#{from_file} does not exist!" end tags = get_tags(from_file) rating = get_rating(from_file) to_files = fu_list(to_files) to_files.each { |file| set_tags(tags, file) unless (tags == nil or tags.empty?) set_rating(rating, file) unless rating == 0.0 } end
error()
click to toggle source
# File lib/openmeta/macruby.rb, line 27 def error @error ||= Pointer.new(:id) end
get_rating(path)
click to toggle source
# File lib/openmeta/macruby.rb, line 82 def get_rating(path) rating = OpenMeta.getRating(File.expand_path(path), error:error) if error.value raise Openmeta::ObjCError, error.value.inspect end rating end
set_rating(rating, path)
click to toggle source
# File lib/openmeta/macruby.rb, line 90 def set_rating(rating, path) e = OpenMeta.setRating(rating, path:File.expand_path(path)) if e raise Openmeta::ObjCError, e.inspect end end
ui()
click to toggle source
# File lib/openmeta/macruby.rb, line 23 def ui @ui ||= UI.new end
with_friendly_errors() { || ... }
click to toggle source
# File lib/openmeta/friendly_errors.rb, line 2 def self.with_friendly_errors begin yield rescue Openmeta::OpenmetaError => e Openmeta.ui.error e.message Openmeta.ui.debug e.backtrace.join("\n") exit e.status_code rescue Interrupt => e Openmeta.ui.error "\nQuitting..." Openmeta.ui.debug e.backtrace.join("\n") exit 1 rescue SystemExit => e exit e.status rescue Exception => e Openmeta.ui.error( "Unfortunately, a fatal error has occurred. Please see the Openmeta \n" \ "troubleshooting documentation. Thanks!\n #{e.inspect} #{e.backtrace.join("\n")}\n") raise e end end