block-kit 1.0.5 → 1.0.6

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: 9eb45957df50e7755b070ec1e7167490ab8f9f399699ee5de352552f43b6946f
4
- data.tar.gz: bc88817b9ba976aa1e4804d5e42feb85fa6d42fdcc74cd029ff8f2272ebf3c90
3
+ metadata.gz: a142c83644eae7923a991bffd10fab97d37a473a9b1cd0f272ffe095bec84e76
4
+ data.tar.gz: b85f5fd6a7bc53e2c10ea911aa12c6a1eb04ff5534ba9b204c65636ac429ef29
5
5
  SHA512:
6
- metadata.gz: f41484044c660930c2c4754fcff3e97e046da19cb14ffd6e4a1af83055e6e5ebcd9d5ca16ec04a538db0e8fc9b22490951ac37f0b27ecbae1401ab3bd0b068de
7
- data.tar.gz: fbce285e1a58fb5c91309743fbdff18a01c477d9779e44c07336c62253957cc8a0507316476fa49fffa1696a1187e12cc32e57119df2dfea93ee0c6dddbc9fcf
6
+ metadata.gz: b7c2e1713de7c0136bf9fc7a6180876214c345a16d51d0f9a1391128f58bd6d9b5ec0c2f3c820b0b425b25db81e524e6a3c185890c199cd17454f5efed050c30
7
+ data.tar.gz: 7b7537a078c37df48f3ff1a468c4f495cdd6e21777a6267f3c4595889e4be9858903f2859843f1489068e8491da4fab441c13bb7e9566560d9d3d9f5e14a294f
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 3.4.4
1
+ ruby 4.0.1
@@ -4,7 +4,7 @@ module BlockKit
4
4
  module Concerns
5
5
  module HasInitialOption
6
6
  def initial_option
7
- all_options&.reverse&.find(&:initial?)
7
+ all_options&.rfind(&:initial?)
8
8
  end
9
9
 
10
10
  def as_json(*)
@@ -0,0 +1,25 @@
1
+ module BlockKit
2
+ class Configuration
3
+ # Controls whether or not calling `valid?` or `validate` on a block or surface
4
+ # will automatically apply any fixes that would make the block or surface valid.
5
+ attr_accessor :autofix_on_validation
6
+
7
+ # Controls whether or not calling `as_json` on a block or surface will automatically
8
+ # apply any fixes that would make the block or surface valid.
9
+ attr_accessor :autofix_on_render
10
+
11
+ # Controls whether or not autofixes that may change the behavior of your view should
12
+ # be called. This is useful if you would rather post messages or publish views at the
13
+ # cost of behavioral quirks or changes rather than suffer from `invalid_blocks` errors.
14
+ #
15
+ # If you'd prefer to run dangerous autofixers on demand, you can do this by
16
+ # calling `fix_validation_errors(dangerous: true)` on your blocks or surfaces.
17
+ attr_accessor :autofix_dangerously
18
+
19
+ def initialize
20
+ @autofix_on_validation = false
21
+ @autofix_on_render = false
22
+ @autofix_dangerously = false
23
+ end
24
+ end
25
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BlockKit
4
- VERSION = "1.0.5"
4
+ VERSION = "1.0.6"
5
5
  end
data/lib/block_kit.rb CHANGED
@@ -1,10 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "active_support/configurable"
3
+ require "active_support/core_ext/module/attribute_accessors"
4
4
 
5
5
  module BlockKit
6
- include ActiveSupport::Configurable
7
-
8
6
  autoload :Base, "block_kit/base"
9
7
  autoload :Blocks, "block_kit/blocks"
10
8
  autoload :Composition, "block_kit/composition"
@@ -18,8 +16,21 @@ module BlockKit
18
16
  autoload :Types, "block_kit/types"
19
17
  autoload :Validators, "block_kit/validators"
20
18
 
19
+ autoload :Configuration, "block_kit/configuration"
21
20
  autoload :VERSION, "block_kit/version"
22
21
 
22
+ mattr_reader :configuration, default: Configuration.new, instance_reader: false, instance_accessor: false
23
+
24
+ class << self
25
+ alias_method :config, :configuration
26
+ end
27
+
28
+ def self.configure(&block)
29
+ raise ArgumentError, "BlockKit.configure requires a block" unless block_given?
30
+
31
+ yield(configuration)
32
+ end
33
+
23
34
  def self.blocks(attributes = {}, &block)
24
35
  Blocks.new(attributes, &block)
25
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: block-kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Celis
@@ -23,20 +23,6 @@ dependencies:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
25
  version: 7.0.0
26
- - !ruby/object:Gem::Dependency
27
- name: activesupport
28
- requirement: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 7.0.0
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: 7.0.0
40
26
  description: A powerful and flexible DSL-based library for Slack's Block Kit framework,
41
27
  built on ActiveModel.
42
28
  email:
@@ -82,6 +68,7 @@ files:
82
68
  - lib/block_kit/concerns/has_placeholder.rb
83
69
  - lib/block_kit/concerns/has_rich_text_elements.rb
84
70
  - lib/block_kit/concerns/plain_text_emoji_assignment.rb
71
+ - lib/block_kit/configuration.rb
85
72
  - lib/block_kit/elements.rb
86
73
  - lib/block_kit/elements/base.rb
87
74
  - lib/block_kit/elements/base_button.rb
@@ -185,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
172
  - !ruby/object:Gem::Version
186
173
  version: '0'
187
174
  requirements: []
188
- rubygems_version: 3.6.7
175
+ rubygems_version: 4.0.3
189
176
  specification_version: 4
190
177
  summary: A powerful DSL-based library for Slack's Block Kit framework.
191
178
  test_files: []