crumpet 0.1.2 → 0.2.0
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 +4 -4
- data/README.md +5 -2
- data/lib/crumpet/configuration.rb +2 -0
- data/lib/crumpet/renderer.rb +3 -1
- data/lib/crumpet/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3ac3fa7d86ded8754d6ff31a719d1b419a9e3f69
|
|
4
|
+
data.tar.gz: f88db704c061abc52c08ced92d067f6d81f6a0fd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
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
|
|
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
|
data/lib/crumpet/renderer.rb
CHANGED
|
@@ -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))
|
|
130
|
+
options.fetch(option, Crumpet.config.send(option.to_sym))
|
|
129
131
|
end
|
|
130
132
|
|
|
131
133
|
def crumb_option_or_default(crumb, option)
|
data/lib/crumpet/version.rb
CHANGED
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.
|
|
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-
|
|
11
|
+
date: 2017-05-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|