Class: Expd::Expander
- Inherits:
-
Object
- Object
- Expd::Expander
- Defined in:
- lib/expd/expander.rb
Instance Method Summary collapse
- #expand(name, opts = {}) ⇒ Object
-
#initialize(snippets) ⇒ Expander
constructor
A new instance of Expander.
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 (name, opts = {}) exp = @snippets.fetch(name, "").chomp copy_to_clipboard exp if opts[:copy] && !exp.empty? exp end |