crumpet 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 46c020bb8b8fd33ae4e359306880ddf0c37978df
4
- data.tar.gz: 39dfcf96365be7747864c1718d66b018d1666799
3
+ metadata.gz: 3ac3fa7d86ded8754d6ff31a719d1b419a9e3f69
4
+ data.tar.gz: f88db704c061abc52c08ced92d067f6d81f6a0fd
5
5
  SHA512:
6
- metadata.gz: 5e57311ee26d89332c8c4d12b5a5b1d63c73c36df1ac501e96b63d3d9a26e56600392f4ec1013c2b53de4e49541d8001ab096b707ade824d52ec89571633226c
7
- data.tar.gz: b6366304158073f442de67cdbec8a48001ca2fda0a274a11db2a8d1765d4ecefa4936c1cb67e8b2c873df59aec6c1f6012cf1cb0b2b5834e3c95db973c2d820a
6
+ metadata.gz: 0d1f5550efe4909e5cbc7b9a5c8b04a28544593bd08cf662ebb63eabcee600845a3964564fab2674b56456065657dd8a2b7e51f2c5375da2884085a061e16edc
7
+ data.tar.gz: 28130667dcc36277fb312e20e36429b4dba430cb6fc6f0e29692c963827da3c175d44dd5dbf993e088a6e24d9a86c98856d629f246149088f333bb3739e9e9e2
data/README.md CHANGED
@@ -41,11 +41,14 @@ end
41
41
 
42
42
  ## Development
43
43
 
44
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
44
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run
45
+ the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
45
46
 
46
47
  ## Contributing
47
48
 
48
- Bug reports and pull requests are welcome on GitHub at https://github.com/blaknite/crumpet. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
49
+ Bug reports and pull requests are welcome on GitHub at https://github.com/blaknite/crumpet. This
50
+ project is intended to be a safe, welcoming space for collaboration, and contributors are expected
51
+ to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
49
52
 
50
53
 
51
54
  ## License
@@ -1,6 +1,7 @@
1
1
  module Crumpet
2
2
  class Configuration
3
3
  attr_accessor :format
4
+ attr_accessor :render_when_blank
4
5
  attr_accessor :link
5
6
  attr_accessor :separator
6
7
  attr_accessor :default_crumb_class
@@ -16,6 +17,7 @@ module Crumpet
16
17
 
17
18
  def initialize
18
19
  @format = :html
20
+ @render_when_blank = true
19
21
  @link = true
20
22
  @separator = " » ".html_safe
21
23
  @default_crumb_class = nil
@@ -10,6 +10,8 @@ module Crumpet
10
10
  end
11
11
 
12
12
  def render
13
+ return '' if crumbs.empty? && !option_or_default(:render_when_blank)
14
+
13
15
  case option_or_default(:format)
14
16
  when :html
15
17
  output = crumbs.map{ |crumb| render_html(crumb) }.join(option_or_default(:separator)).html_safe
@@ -125,7 +127,7 @@ module Crumpet
125
127
  end
126
128
 
127
129
  def option_or_default(option)
128
- options.fetch(option, Crumpet.config.send(option.to_sym)).clone
130
+ options.fetch(option, Crumpet.config.send(option.to_sym))
129
131
  end
130
132
 
131
133
  def crumb_option_or_default(crumb, option)
@@ -1,3 +1,3 @@
1
1
  module Crumpet
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crumpet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grant Colegate
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-16 00:00:00.000000000 Z
11
+ date: 2017-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails