fa_rails 0.1.27 → 0.1.29

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
  SHA256:
3
- metadata.gz: 79592033f8cde3a69b9c151928289df8ea5564c6657c3c32aba9464ea5a80014
4
- data.tar.gz: 5e30a6766b53e7563dd1759656ab04e50720fb270e72509196fbdb1045bf9813
3
+ metadata.gz: 066ee0296fe9eddacfb54f58f2425661b2be548b0590ad04523089d6f61d0a25
4
+ data.tar.gz: 9730e00557d1ae282e262fd7067b99e9d667f2308b7aab2984d2390fa68d6f3c
5
5
  SHA512:
6
- metadata.gz: a43c475dd94f739d326a2f855f69bd525d47935113eb77a193787eded0879bee3985548da66fa99a1628b9fc9afe04ceba9ee63e450cc2b94d03b3f855a42b8d
7
- data.tar.gz: 45338d64be37baddb0ef1802a0b13a8338d304104305e262ec2f201dbb5009bea8f2c3f5afdfbf3ccd9f561a66c182cd8923a3b768e5e16a00103d4039f396c6
6
+ metadata.gz: e0081789f2c062f2aae50d568f58cf8d11e5cd4b17954ca47cf27c6a1608119a543fd562e6b616677b16d5c98b97066bbabe0555b4d1588afb12f34077ad6cb7
7
+ data.tar.gz: 04c3fa02408f7e88c98973e75765a28668b302afc1e69909a647c677f26d408c5c558d27a208d1a9f18b88fcf0cb69c08658c316c6826e73cabfcfad27bf0209
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  doc/
2
2
  coverage/
3
3
  tmp/
4
+ *.gem
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fa_rails (0.1.27)
4
+ fa_rails (0.1.29)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -70,7 +70,7 @@ FA::Link.kit('kit-id')
70
70
  The `FA` module contains three main subclasses: `Icon`, `Span`, and `Layer`.
71
71
  Argument formatting is consistent throughout.
72
72
 
73
- `Icon` and `Span` are the units of this module. Both can be used individually.
73
+ `Icon` and `Span` are the units of this module. Both can be used individually.
74
74
  The first argument of each class's `new` method can be either a String/Symbol of
75
75
  the name of the FontAwesome icon, or a Hash containing the complete
76
76
  configuration for the object.
@@ -99,6 +99,7 @@ A single FontAwesome icon.
99
99
  fa #=> String / Symbol – OR Hash
100
100
  options #=> Hash
101
101
  style: Symbol # One of [:solid, :regular, :light, :brands], default :solid
102
+ mode: Symbol # One of [:sharp], default: nil
102
103
  size: Integer # Stepped scaling factor
103
104
 
104
105
  css: String # Arbitrary CSS classes, space-delimited
@@ -167,6 +168,10 @@ FA::Icon.p('fire-alt', fa: 'swap-opacity')
167
168
  FA::Icon.p('fire-alt', style: :duotone, raw_css: { '--fa-primary-opacity' => '0.6', '--fa-secondary-opacity' => '0.4' })
168
169
  #=> "<i class='fad fa-fire-alt fa-1x' style='--fa-primary-opacity: 0.4; --fa-secondary-opacity: 0.6;' data-fa-transform='' title=''></i>"
169
170
 
171
+ # Solid sharp house icon
172
+ FA::Icon.p('house', mode: :sharp)
173
+ #=> "<i class='fas fa-sharp fa-fire-alt fa-1x' style='' data-fa-transform='' title=''></i>"
174
+
170
175
  # You can also use this simplified configuration option for adding styles
171
176
  # This is reforatted and merged into :raw_css
172
177
  # Accepts either snake_case symbols or spear-case strings as keys, and strings or symbols as values
data/fa_rails.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'fa_rails'
3
- s.version = '0.1.27'
4
- s.date = '2021-05-26'
3
+ s.version = '0.1.29'
4
+ s.date = '2023-03-13'
5
5
  s.summary = 'FontAwesome helper for Rails'
6
6
  s.description = 'A helper module for using FontAwesome icons in Rails.'
7
7
  s.homepage = 'http://rubygems.org/gems/fa_rails'
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.files = `git ls-files`.split("\n")
13
13
  s.test_files = `git ls-files -- spec/*`.split("\n")
14
14
 
15
- s.required_ruby_version = '~> 2.4'
15
+ s.required_ruby_version = '>= 2.4'
16
16
 
17
17
  s.add_development_dependency 'rake', '~> 12.2', '>= 12.2.1'
18
18
  s.add_development_dependency 'rspec', '~> 3.7', '>= 3.7.0'
data/lib/fa/base.rb CHANGED
@@ -1,13 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FA
4
- # FontAwesome 5 (Pro) Helper core class for inheritance
4
+ # FontAwesome 6 (Pro) Helper core class for inheritance
5
5
  class Base
6
6
  STYLES = {
7
+ nil => 's',
7
8
  solid: 's', regular: 'r', light: 'l', thin: 't',
8
9
  duotone: 'd', brands: 'b', kit_upload: 'k'
9
10
  }.freeze
10
11
 
12
+ MODES = {
13
+ nil => '',
14
+ sharp: 's'
15
+ }.freeze
16
+
11
17
  # Outputs the formatted string directly.
12
18
  def raw
13
19
  #
@@ -141,9 +147,10 @@ module FA
141
147
 
142
148
  def parse_style(options)
143
149
  return if options[:css].to_s.match?(/\bfa[#{STYLES.values.join}]\b/)
144
- return 'fas' unless STYLES.keys.include?(options[:style])
145
150
 
146
- 'fa' + STYLES[options[:style]]
151
+ style = 'fa'
152
+ style += STYLES[options[:style]]
153
+ style += MODES[options[:mode]]
147
154
  end
148
155
  end
149
156
  end
data/spec/lib/fa_spec.rb CHANGED
@@ -91,6 +91,12 @@ RSpec.describe FA do
91
91
  )
92
92
  end
93
93
 
94
+ it 'generates the correct sharp icon' do
95
+ expect(FA::Icon.p(:house, mode: :sharp)).to eql(
96
+ "<i class='fass fa-house fa-1x' style='' data-fa-transform='' title=''></i>"
97
+ )
98
+ end
99
+
94
100
  it 'should generate the correct icon with styles' do
95
101
  expect(
96
102
  FA::Icon.p(
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fa_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.27
4
+ version: 0.1.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-26 00:00:00.000000000 Z
11
+ date: 2023-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -105,7 +105,7 @@ require_paths:
105
105
  - doc
106
106
  required_ruby_version: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '2.4'
111
111
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -114,8 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  - !ruby/object:Gem::Version
115
115
  version: '0'
116
116
  requirements: []
117
- rubyforge_project:
118
- rubygems_version: 2.7.6
117
+ rubygems_version: 3.2.30
119
118
  signing_key:
120
119
  specification_version: 4
121
120
  summary: FontAwesome helper for Rails