bridgetown-slim-support 1.0.0 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 768c9a031faa70ecd91541fc7c44d6e37312a9631cedf6056bea103c88023572
4
- data.tar.gz: a7f00d36f7a718b618628445e15ccda0b8008b6b7df2cf1c61c65bbf03746d0a
3
+ metadata.gz: fc23a5d9844d9b6362084bbe0545f3b3fb9d1336a0f3adc50182e9ef5cc70527
4
+ data.tar.gz: 7e696948cf63c04647cd93475f6d9ae03cab936800ba26b9b9b25774cd8c7ca2
5
5
  SHA512:
6
- metadata.gz: b3782237ad2900085f3dadba5ae365b54612267ef3414feea4c0197d5c62ea49f90db0ed31c9ce60fdb0cbbdc8545b11aa9c6a18d7dce66b898cb1dc68b32b48
7
- data.tar.gz: eac26db4c1fff4f3e8290f210f773554f233a1d8ece6a9ad6335aabf7eac6c4ecef0297e56ebbf2ae0d8a5d36f8bf0d3b35c92b5a16f3ba90ff07f8552531dbd
6
+ metadata.gz: 7c53b0ddb6b7bb45fb99c921b723d6cff3b0c8f9a5fd0717f64e31d5e2245e39169b096f433cf25f9cb9d55be52a1096af88ce7c76275cbfcbf6319a36703493
7
+ data.tar.gz: 3c02b32960075ca81c73d777135c8fdf7046281791a0236973f07de11eb2bd1695fff4a516fad07c282d3847ead1a3aea5cff9b48bf8a4d3e8aa1a97c05620ee
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Minimal ActiveSupport-like present?/blank? helpers so Slim templates
4
+ # can keep using value.present? / value.blank? without pulling in AS.
5
+ module Bridgetown
6
+ module SlimSupport
7
+ module CoreExt
8
+ end
9
+ end
10
+ end
11
+
12
+ unless Object.method_defined?(:blank?)
13
+ class Object
14
+ def blank?
15
+ respond_to?(:empty?) ? !!empty? : !self
16
+ end
17
+
18
+ def present?
19
+ !blank?
20
+ end
21
+ end
22
+ end
23
+
24
+ unless NilClass.method_defined?(:blank?)
25
+ class NilClass
26
+ def blank?
27
+ true
28
+ end
29
+ end
30
+ end
31
+
32
+ unless FalseClass.method_defined?(:blank?)
33
+ class FalseClass
34
+ def blank?
35
+ true
36
+ end
37
+ end
38
+ end
39
+
40
+ unless TrueClass.method_defined?(:blank?)
41
+ class TrueClass
42
+ def blank?
43
+ false
44
+ end
45
+ end
46
+ end
47
+
48
+ unless String.method_defined?(:blank?)
49
+ class String
50
+ def blank?
51
+ strip.empty?
52
+ end
53
+ end
54
+ end
55
+
56
+ unless Array.method_defined?(:blank?)
57
+ class Array
58
+ def blank?
59
+ empty?
60
+ end
61
+ end
62
+ end
63
+
64
+ unless Hash.method_defined?(:blank?)
65
+ class Hash
66
+ def blank?
67
+ empty?
68
+ end
69
+ end
70
+ end
@@ -33,7 +33,7 @@ module Bridgetown
33
33
  end
34
34
 
35
35
  if File.exist?(file_path)
36
- if alt_blank?(options[:alt])
36
+ if options[:alt].blank?
37
37
  options[:alt] = humanized_alt_from_file(file_path)
38
38
  end
39
39
 
@@ -50,7 +50,7 @@ module Bridgetown
50
50
  end
51
51
  end
52
52
 
53
- if alt_blank?(options[:alt])
53
+ if options[:alt].blank?
54
54
  options[:alt] = humanized_alt_from_path(path)
55
55
  end
56
56
 
@@ -119,10 +119,6 @@ module Bridgetown
119
119
 
120
120
  private
121
121
 
122
- def alt_blank?(value)
123
- value.nil? || (value.respond_to?(:empty?) && value.empty?)
124
- end
125
-
126
122
  def humanized_alt_from_file(file_path)
127
123
  humanized_alt_from_basename(File.basename(file_path))
128
124
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Bridgetown
4
4
  module SlimSupport
5
- VERSION = "1.0.0"
5
+ VERSION = "1.1.0"
6
6
  end
7
7
  end
@@ -7,6 +7,7 @@ require "slim"
7
7
  require "tilt"
8
8
 
9
9
  require_relative "slim_support/version"
10
+ require_relative "slim_support/core_ext/present"
10
11
  require_relative "slim_support/helpers"
11
12
  require_relative "slim_support/converter"
12
13
  require_relative "slim_support/view"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridgetown-slim-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Atelier Mirai
@@ -104,6 +104,7 @@ files:
104
104
  - lib/bridgetown-slim-support.rb
105
105
  - lib/bridgetown/slim_support.rb
106
106
  - lib/bridgetown/slim_support/converter.rb
107
+ - lib/bridgetown/slim_support/core_ext/present.rb
107
108
  - lib/bridgetown/slim_support/helpers.rb
108
109
  - lib/bridgetown/slim_support/plugin.rb
109
110
  - lib/bridgetown/slim_support/version.rb
@@ -129,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
130
  - !ruby/object:Gem::Version
130
131
  version: '0'
131
132
  requirements: []
132
- rubygems_version: 3.7.2
133
+ rubygems_version: 4.0.3
133
134
  specification_version: 4
134
135
  summary: Slim template support helpers for Bridgetown
135
136
  test_files: []