Sha256: 449c378911338de075a064a47a83295187ab91212a1fc287cc7203bc6bcb30a8

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

require 'fspath'
require 'shellwords'

class FSPath
  module Mac
    # Move to trash
    def move_to_trash
      # actual implementation in extension
    end

    FINDER_LABEL_COLORS = [nil, :grey, :green, :purple, :blue, :yellow, :red, :orange].freeze
    FINDER_LABEL_COLOR_ALIASES = {:gray => :grey}.freeze

    # Get finder label (one of nil, :orange, :red, :yellow, :blue, :purple, :green and :grey)
    def finder_label
      FINDER_LABEL_COLORS[finder_label_number]
    end

    # Set finder label (:grey is same as :gray, nil or false as :none)
    def finder_label=(color)
      index = FINDER_LABEL_COLORS.index(FINDER_LABEL_COLOR_ALIASES[color] || color)
      raise "Unknown label #{color.inspect}" unless index
      self.finder_label_number = index
    end

    # Get spotlight comment
    def spotlight_comment
      # actual implementation in extension
    end

    # Set spotlight comment
    def spotlight_comment=(comment)
      # actual implementation in extension
    end
  end

  include Mac
end

require 'fspath/mac/ext'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fspath-mac-3.2.1 lib/fspath/mac.rb
fspath-mac-3.2.0 lib/fspath/mac.rb