Class: FinderTags
- Inherits:
-
Object
- Object
- FinderTags
- Defined in:
- lib/finder_tags.rb,
lib/finder_tags/version.rb,
lib/finder_tags/titlecase.rb
Defined Under Namespace
Modules: Titlecase Classes: Tag
Constant Summary collapse
- FINDERINFO_KEY =
"com.apple.FinderInfo"
- USERTAGS_KEY =
"com.apple.metadata:_kMDItemUserTags"
- TAG_BYTE_OFFSET =
9
- LEGACY_COLORS =
i could do something tricksy (color >> 1), but I don’t feel like it two arrays of colors is fine by me
%i[ none none grey grey green green purple purple blue blue yellow yellow red red orange orange ].freeze
- MODERN_COLORS =
%i[ none grey green purple blue yellow red orange ].freeze
- VERSION =
"0.1.1"
Instance Method Summary collapse
- #extended_tags ⇒ Object
-
#initialize(file) ⇒ FinderTags
constructor
A new instance of FinderTags.
- #legacy_tag ⇒ Object
- #tags ⇒ Object
Constructor Details
#initialize(file) ⇒ FinderTags
Returns a new instance of FinderTags.
38 39 40 |
# File 'lib/finder_tags.rb', line 38 def initialize(file) @file = file end |
Instance Method Details
#extended_tags ⇒ Object
58 59 60 |
# File 'lib/finder_tags.rb', line 58 def @extended_tags ||= .map(&method(:raw_to_tag)) end |
#legacy_tag ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/finder_tags.rb', line 48 def legacy_tag @legacy_tag ||= begin return Tag.new("None", :none) if tag_byte.nil? color = LEGACY_COLORS[tag_byte.to_i] Tag.new(color.to_s.titlecase, color) end end |
#tags ⇒ Object
42 43 44 45 46 |
# File 'lib/finder_tags.rb', line 42 def = = [legacy_tag] if .none? && legacy_tag.color != :none end |