Class: Ekylibre::Snippet

Inherits:
Object
  • Object
show all
Defined in:
lib/ekylibre/snippet.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, path, options = {}) ⇒ Snippet

Returns a new instance of Snippet.


19
20
21
22
23
# File 'lib/ekylibre/snippet.rb', line 19

def initialize(name, path, options = {})
  @name = name
  @path = path
  @options = options
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name


17
18
19
# File 'lib/ekylibre/snippet.rb', line 17

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path


17
18
19
# File 'lib/ekylibre/snippet.rb', line 17

def path
  @path
end

Class Method Details

.add(name, path, options = {}) ⇒ Object


6
7
8
9
10
# File 'lib/ekylibre/snippet.rb', line 6

def add(name, path, options = {})
  place = options.delete(:place) || :side
  @snippets[place] ||= []
  @snippets[place] << new(name, path, options)
end

.at(place) ⇒ Object


12
13
14
# File 'lib/ekylibre/snippet.rb', line 12

def at(place)
  @snippets[place] || []
end

Instance Method Details

#optionsObject


25
26
27
# File 'lib/ekylibre/snippet.rb', line 25

def options
  @options.dup
end