fa_rails 0.1.5 → 0.1.6

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: 9fbd3a8577ad17608b6c22a6f859bd6c5310d754
4
- data.tar.gz: 2ad7baf895420340358d2a3b996d737094eeb017
3
+ metadata.gz: 8a1756a2645940b450bf67a8553f02b46326f85f
4
+ data.tar.gz: 595c7c31e7df60adb382890be3582359bb1eec0f
5
5
  SHA512:
6
- metadata.gz: 422152f48a9815e5423118f43f1e8d5851d1926dda4500ba8584525a0a96e0af3bae1dd1273fd5cad7feb93a062ccaae2bda4b71c6d765ee1816626b8583e90d
7
- data.tar.gz: 3fa5f813afa216497416d20cd180e03a943b32b4d7f9ac3c2e7720109b3b8baf6e51e4c8e6b7f81f17543bf472239fc9ee35344ef52f1d1bef0f8201b700c197
6
+ metadata.gz: fa3bd92ff8e593410d159adef7554887251927c9c7a6ef7eb7eed67b5c59c97a17647f199ab93deb47339df283e507d8d87781d6f2f26b59440cf02f3d60767e
7
+ data.tar.gz: 6fd8bb397108d6ed430b50b09375ac010a076e7fbbac587370aaaeaab598c4339111326636fe9cb335ef2ec414664b8c9f8ddfce6bed328245ae625a77429c4c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fa_rails (0.1.5)
4
+ fa_rails (0.1.6)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/fa_rails.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'fa_rails'
3
- s.version = '0.1.5'
3
+ s.version = '0.1.6'
4
4
  s.date = '2018-07-30'
5
5
  s.summary = 'FontAwesome helper for Rails'
6
6
  s.description = 'A helper module for using FontAwesome icons in Rails.'
data/lib/fa/link.rb ADDED
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FA
4
+ # FontAwesome 5 (Pro) Helper for generating CDN links
5
+ class Link < FA::Base
6
+ # Outputs the CDN link.
7
+ def initialize(version:, integrity:, pro: true)
8
+ @version = version
9
+ @integrity = integrity
10
+ @subdomain = pro ? 'pro' : 'use'
11
+ end
12
+
13
+ # Outputs the formatted link directly.
14
+ def raw
15
+ "<link rel=\"stylesheet\" href=\"#{url}\" " \
16
+ "integrity=\"#{@integrity}\" crossorigin=\"anonymous\">"
17
+ end
18
+
19
+ private
20
+
21
+ def url
22
+ "https://#{@subdomain}.fontawesome.com/releases/#{@version}/css/all.css"
23
+ end
24
+ end
25
+ end
data/lib/fa.rb CHANGED
@@ -9,12 +9,5 @@ module FA
9
9
  require 'fa/icon'
10
10
  require 'fa/span'
11
11
  require 'fa/layer'
12
-
13
- def fa_cdn_link(version:, integrity:, pro: true)
14
- subdomain = pro ? 'pro' : 'use'
15
- url = "https://#{subdomain}.fontawesome.com/releases/#{version}/css/all.css"
16
-
17
- "<link rel=\"stylesheet\" href=\"#{url}\" " \
18
- "integrity=\"#{integrity}\" crossorigin=\"anonymous\">"
19
- end
12
+ require 'fa/link'
20
13
  end
data/spec/lib/fa_spec.rb CHANGED
@@ -3,11 +3,9 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  RSpec.describe FA do
6
- include FA
7
-
8
6
  it 'should generate the correct link tag' do
9
- tag = fa_cdn_link(version: 'v0.1.2', integrity: 'sha384-abc', pro: true)
10
- expect(tag).to eql(
7
+ tag = FA::Link.new(version: 'v0.1.2', integrity: 'sha384-abc', pro: true)
8
+ expect(tag.safe).to eql(
11
9
  '<link rel="stylesheet" ' \
12
10
  'href="https://pro.fontawesome.com/releases/v0.1.2/css/all.css" ' \
13
11
  'integrity="sha384-abc" crossorigin="anonymous">'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fa_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander
@@ -87,6 +87,7 @@ files:
87
87
  - lib/fa/base.rb
88
88
  - lib/fa/icon.rb
89
89
  - lib/fa/layer.rb
90
+ - lib/fa/link.rb
90
91
  - lib/fa/span.rb
91
92
  - spec/lib/fa_spec.rb
92
93
  - spec/spec_helper.rb