class SublimeTextKit::Snippets::Collector
Constants
- DEFAULT_USER_PATH
Attributes
environment[R]
model[R]
user_path[R]
Public Class Methods
new(model: Snippet, user_path: DEFAULT_USER_PATH, environment: ENV)
click to toggle source
# File lib/sublime_text_kit/snippets/collector.rb, line 11 def initialize model: Snippet, user_path: DEFAULT_USER_PATH, environment: ENV @model = model @user_path = user_path @environment = environment end
Public Instance Methods
call()
click to toggle source
# File lib/sublime_text_kit/snippets/collector.rb, line 25 def call root_path.glob("*.sublime-snippet") .map { |path| model.new REXML::Document.new(path.read) } .sort_by(&:description) end
home_path()
click to toggle source
# File lib/sublime_text_kit/snippets/collector.rb, line 17 def home_path Pathname environment.fetch("HOME") end
root_path()
click to toggle source
# File lib/sublime_text_kit/snippets/collector.rb, line 21 def root_path home_path.join user_path end