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 +4 -4
- data/Gemfile.lock +1 -1
- data/fa_rails.gemspec +1 -1
- data/lib/fa/link.rb +25 -0
- data/lib/fa.rb +1 -8
- data/spec/lib/fa_spec.rb +2 -4
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a1756a2645940b450bf67a8553f02b46326f85f
|
4
|
+
data.tar.gz: 595c7c31e7df60adb382890be3582359bb1eec0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa3bd92ff8e593410d159adef7554887251927c9c7a6ef7eb7eed67b5c59c97a17647f199ab93deb47339df283e507d8d87781d6f2f26b59440cf02f3d60767e
|
7
|
+
data.tar.gz: 6fd8bb397108d6ed430b50b09375ac010a076e7fbbac587370aaaeaab598c4339111326636fe9cb335ef2ec414664b8c9f8ddfce6bed328245ae625a77429c4c
|
data/Gemfile.lock
CHANGED
data/fa_rails.gemspec
CHANGED
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 =
|
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.
|
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
|