Class: Expd::Expander

Inherits:
Object
  • Object
show all
Defined in:
lib/expd/expander.rb

Instance Method Summary collapse

Constructor Details

#initialize(snippets) ⇒ Expander

Returns a new instance of Expander.



3
4
5
# File 'lib/expd/expander.rb', line 3

def initialize(snippets)
  @snippets = snippets
end

Instance Method Details

#expand(name, opts = {}) ⇒ Object



7
8
9
10
11
# File 'lib/expd/expander.rb', line 7

def expand(name, opts = {})
  exp = @snippets.fetch(name, "").chomp
  copy_to_clipboard exp if opts[:copy] && !exp.empty?
  exp
end