bread 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9dddf9bec9d9c5924da11d0161408b651ca33355
4
- data.tar.gz: 308292d29923318b87df9f048f54254d98356015
3
+ metadata.gz: 657afe5153a81090fcf0df69e85ac8c5ff45e4de
4
+ data.tar.gz: c285e78eec2c8e826dd235a24b3a2a7788c57d8d
5
5
  SHA512:
6
- metadata.gz: feee9d3d20681bdff9933768e79d768cd867072eea640e421df9c8518b73e7ab1460e57fba912fc56d549abc87afdce2cf5b095a92d5c5ab70f2b4079dde620c
7
- data.tar.gz: 388b949a593d771631f42cb2df673d91c5d2877d501823895fd1c97171035d9eb5239c5edb16d035f681abeb1ff51610315dfc69b89b3356703256ac43e6f3de
6
+ metadata.gz: 8e85b52f169c79262d9c42bc7f6658fb18ab5cdb285d352f86e52d1961c4ea7bd10b93181202de46d992e9a76203ec4c2b94c66a5292a234febcd0c2fa11727c
7
+ data.tar.gz: f86d02ac35ab55ea7bebdc215becdb70df9b577702f53d6b0194203d0771138cd7eec177cbb1ede0179f6e0734dcfa1a8a6f66cdbb2b07219868c4855deeacbe
data/lib/bread/crumb.rb CHANGED
@@ -2,7 +2,7 @@ module Bread
2
2
  class Crumb < Hash
3
3
 
4
4
  def initialize(context, title, path, options)
5
- @context = context
5
+ self.context = context
6
6
  options.merge(title: title, path: path).each do |k, v|
7
7
  self[k] = v
8
8
  end
@@ -16,9 +16,21 @@ module Bread
16
16
  self[:path]
17
17
  end
18
18
 
19
+ def first?
20
+ self[:_first]
21
+ end
22
+
23
+ def last?
24
+ self[:_last]
25
+ end
26
+
19
27
  def current?
20
- @context.current_page? path
28
+ context.current_page? path
21
29
  end
22
30
 
31
+ private
32
+
33
+ attr_accessor :context
34
+
23
35
  end
24
36
  end
data/lib/bread/helper.rb CHANGED
@@ -12,6 +12,7 @@ module Bread
12
12
  crumbs_to_block = crumb_definitions[key] || :crumb_definitions_not_found
13
13
  self.instance_eval(&crumbs_to_block)
14
14
  end
15
+ @crumbs = determinate_first_and_last(@crumbs)
15
16
  @crumbs
16
17
  end
17
18
 
@@ -19,6 +20,14 @@ module Bread
19
20
  @crumbs << Crumb.new(self, title, path, options)
20
21
  end
21
22
 
23
+ private
24
+
25
+ def determinate_first_and_last(crumbs)
26
+ crumbs.first[:_first] = true
27
+ crumbs.last[:_last] = true
28
+ crumbs
29
+ end
30
+
22
31
  end
23
32
  end
24
33
 
data/lib/bread/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Bread
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bread
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thiago Pinto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-04 00:00:00.000000000 Z
11
+ date: 2014-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler