Module: Bakery

Defined in:
lib/bakery/cake.rb,
lib/bakery.rb,
lib/bakery/bakery.rb,
lib/bakery/version.rb

Overview

Copyright © 2013 Nathan Currier

Use, modification, and distribution are all subject to the Boost Software License, Version 1.0. (See the accompanying file LICENSE.md or at rideliner.tk/LICENSE.html).

<description>

Defined Under Namespace

Classes: Cake

Constant Summary collapse

ROOT_DIR =
Dir.pwd
LIB_DIR =
File.dirname __FILE__
INGREDIENTS_DIR =
File.join LIB_DIR, 'bakery', 'ingredients'
INGREDIENTS_DETAIL_DIR =
File.join INGREDIENTS_DIR, 'detail'
ICING_SEARCH =
PathSearch.new [ Dir.home, File.join(Dir.home, '.bakery'), File.join('/', 'etc', 'bakery') ]
VERSION =
'0.4.0'

Class Method Summary collapse

Class Method Details

.[](symbol) ⇒ Object



52
53
54
55
56
57
58
# File 'lib/bakery/bakery.rb', line 52

def [] symbol
  if icing = getCake.icing[symbol]
    icing
  else
    @defaultIcing[symbol]
  end
end

.addCakeObject



60
61
62
63
64
65
# File 'lib/bakery/bakery.rb', line 60

def addCake
  cake = Cake.new @currentCake

  @cakes.push cake
  @currentCake = cake
end

.cakesObject



48
49
50
# File 'lib/bakery/bakery.rb', line 48

def cakes
  @cakes
end

.getCakeObject



67
68
69
# File 'lib/bakery/bakery.rb', line 67

def getCake
  @currentCake
end

.getLatestMarkerOfType(type) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/bakery/bakery.rb', line 30

def getLatestMarkerOfType type
  @markers.reverse_each { |marker|
    if marker.is_a? type
      return marker
    end
  }

  nil
end

.icingObject



40
41
42
# File 'lib/bakery/bakery.rb', line 40

def icing
  @defaultIcing
end

.markersObject



44
45
46
# File 'lib/bakery/bakery.rb', line 44

def markers
  @markers
end

.removeMarkerLayerFromStack(path) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/bakery/bakery.rb', line 19

def removeMarkerLayerFromStack path
  # remove all markers that are in the current directory
  @markers.select! { |marker|
    !marker.getPath.start_with? path
  }

  if @currentCake.root == path
    @currentCake = @currentCake.parent
  end
end