Class: SublimeTextKit::Snippets::Reader

Inherits:
Object
  • Object
show all
Defined in:
lib/sublime_text_kit/snippets/reader.rb

Overview

Reads snippet and loads record into memory.

Instance Method Summary collapse

Constructor Details

#initialize(model: Model, document: REXML::Document) ⇒ Reader

Returns a new instance of Reader.



9
10
11
12
# File 'lib/sublime_text_kit/snippets/reader.rb', line 9

def initialize model: Model, document: REXML::Document
  @model = model
  @document = document
end

Instance Method Details

#call(path) ⇒ Object



14
# File 'lib/sublime_text_kit/snippets/reader.rb', line 14

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