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-17.6.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-17.5.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-17.4.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-17.3.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-17.2.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-17.1.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-17.0.1 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-17.0.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-16.5.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-16.3.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-16.2.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-16.1.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-16.0.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-15.2.1 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-15.2.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-15.1.0 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-15.0.3 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-15.0.2 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-15.0.1 lib/sublime_text_kit/snippets/reader.rb
sublime_text_kit-15.0.0 lib/sublime_text_kit/snippets/reader.rb