Sha256: bc72d9bb3913565f74914de67a18cd9ebeb416df6a6c813ea4c6a1790287f2f9

Contents?: true

Size: 442 Bytes

Versions: 43

Compression:

Stored size: 442 Bytes

Contents

# frozen_string_literal: true

require "rexml/document"

module SublimeTextKit
  module Snippets
    # Reads snippet and loads record into memory.
    class Reader
      def initialize model: Model, document: REXML::Document
        @model = model
        @document = document
      end

      def call(path) = path.exist? ? model.for(document.new(path.read)) : model.new

      private

      attr_reader :model, :document
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
sublime_text_kit-14.2.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-14.1.2 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-14.1.1 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-14.1.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-14.0.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-13.5.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-13.4.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-13.3.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-13.2.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-13.1.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-13.0.1 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-13.0.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-12.3.2 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-12.3.1 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-12.3.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-12.2.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-12.1.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-12.0.1 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-12.0.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-11.0.3 lib/sublime_text_kit/snippets/reader.rb