Sha256: 0bbc55ed9fd9c50c9087a9f942bdbcffc8b2ab7681c3229be32791596f6ec3e6

Contents?: true

Size: 536 Bytes

Versions: 6

Compression:

Stored size: 536 Bytes

Contents

module Vos
  class Box
    module Marks
      def mark! key
        marks_dir.file(key).create
        @marks_cache = nil
      end

      def has_mark? key
        marks_cache.include? key.to_s
      end
      alias_method :marked?, :has_mark?

      def clear_marks!
        marks_dir.destroy
        @marks_cache = nil
      end

      def marks_dir
        dir "/marks"
      end

      protected
        def marks_cache
          @marks_cache ||= marks_dir.files(bang: false).collect{|file| file.name}
        end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vos-0.4.2 lib/vos/box/marks.rb
vos-0.4.1 lib/vos/box/marks.rb
vos-0.4.0 lib/vos/box/marks.rb
vos-0.3.15 lib/vos/box/marks.rb
vos-0.3.14 lib/vos/box/marks.rb
vos-0.3.13 lib/vos/box/marks.rb