alphasights-sinatra-sprockets 0.0.7 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,6 +19,7 @@ module Sinatra
19
19
  digest = options.key?(:digest) ? options.delete(:digest) : config.digest_assets?
20
20
 
21
21
  options[:src] = asset_path(source, :digest => digest)
22
+ options[:alt] = options.fetch(:alt){ image_alt(source) }
22
23
 
23
24
  if size = options.delete(:size)
24
25
  options[:width], options[:height] = size.split("x") if size =~ %r{^\d+x\d+$}
@@ -148,6 +149,10 @@ module Sinatra
148
149
  tag_options = tag_options(options, escape) if options
149
150
  "<#{name}#{tag_options}>#{escape ? ERB::Util.h(content) : content}</#{name}>"
150
151
  end
152
+
153
+ def image_alt(source)
154
+ File.basename(source, '.*').sub(%r-[[:xdigit:]]{32}\z-, '')
155
+ end
151
156
  end
152
157
  end
153
158
  end
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module Sprockets
3
- VERSION = "0.0.7"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alphasights-sinatra-sprockets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-22 00:00:00.000000000 Z
12
+ date: 2012-04-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sprockets
16
- requirement: &70276788773740 !ruby/object:Gem::Requirement
16
+ requirement: &70145947054260 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '2.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70276788773740
24
+ version_requirements: *70145947054260
25
25
  description: Use Sprockets effectively with Sinatra.
26
26
  email:
27
27
  - jessereiss@gmail.com