grift 0.1.0 → 1.1.0

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: 27b2eccd337c396229e197435ace7c447cc7575b1a0a65deddd350a3e63a3faa
4
- data.tar.gz: 3be36076623ba83a2654a827b5375da903168b8594390678fe461d74a9a5baef
3
+ metadata.gz: a37d5a48e24392779fb59d698491aab83b2ebd26118cd3b25e8af70f2762731e
4
+ data.tar.gz: cde1463f8b56b94dcc94d94cef6fc42629bff64a323c24253c966d733eb910b1
5
5
  SHA512:
6
- metadata.gz: c8080f30c6fd6a9dcdad37e500a575f6056eddb404a155bce5e153761227040684200e00d45d1c06c4e42355ea077fede56e52c7ba29a454a1eefc7717cad806
7
- data.tar.gz: c34f2ac31553fba7687503926e5fc5baa1b282516258fb48d669d157ff1e7b9b6ab8650297cf4ccd0d6741c79045836a18942dff42da90a6bcf2c764193d99a1
6
+ metadata.gz: 87c96bd3c0ba9f35a6aae57b99b4b1efb1e065c3c63a610971d202b0964787661eaec6cdf7a26840e8e246fba012628979f6ffb1999efaa47298302290be4ba1
7
+ data.tar.gz: f5b66d0f079d8850c770fef90768da8a10a62f657f4645901758f0137235eb403cf2cd1f426a7b13ddc16546ba278f0d38776e102a180181a15ce81135b07be9
@@ -0,0 +1 @@
1
+ .github/ @clarkedb
@@ -0,0 +1,37 @@
1
+ # How to become a contributor and submit your own code
2
+
3
+ 1. Submit an issue on GitHub describing your proposed change to this repo
4
+ 1. A repo owner will respond to your issue promptly
5
+ 1. Fork the repo, develop and test your code changes
6
+ 1. Ensure that your code adheres to the existing style in the code to which you are contributing
7
+ 1. Ensure that your code has an appropriate set of tests which all pass
8
+ 1. Title your pull request following [Conventional Commits](https://www.conventionalcommits.org/) styling
9
+ 1. Submit a pull request.
10
+
11
+ ## Policy on inclusive language
12
+
13
+ To make Grift a pleasant and effective experience for everyone, we use try to use inclusive language.
14
+
15
+ These resources can help:
16
+
17
+ - Google's tutorial [Writing inclusive documentation](https://developers.google.com/style/inclusive-documentation) teaches by example, how to reword non-inclusive things.
18
+ - Linux kernel mailing list's [Coding Style: Inclusive Terminology](https://lkml.org/lkml/2020/7/4/229) said "Add no new instances of non-inclusive words, here is a list of words not include new ones of."
19
+ - Linguistic Society of America published [Guidelines for Inclusive Language](https://www.linguisticsociety.org/resource/guidelines-inclusive-language) which concluded: "We encourage all linguists to consider the possible reactions of their potential audience to their writing and, in so doing, to choose expository practices and content that is positive, inclusive, and respectful."
20
+
21
+ This project attempts to improve in these areas. Join us in doing that important work.
22
+
23
+ ## Required checks
24
+
25
+ Before pushing your code and opening a PR, we recommend you run the following checks to avoid
26
+ our GitHub Actions Workflow to block your contribution.
27
+
28
+ ```bash
29
+ # install dependencies
30
+ $ bundle install
31
+
32
+ # Run unit tests and check code coverage
33
+ $ bundle exec rake test
34
+
35
+ # Check code style
36
+ $ bundle exec rubocop
37
+ ```
@@ -0,0 +1,11 @@
1
+ version: 2
2
+
3
+ updates:
4
+ - directory: /
5
+ open-pull-requests-limit: 10
6
+ package-ecosystem: bundler
7
+ target-branch: develop
8
+ schedule:
9
+ interval: weekly
10
+ labels:
11
+ - dependencies
@@ -0,0 +1,46 @@
1
+ name: CI
2
+
3
+ on: push
4
+
5
+ env:
6
+ GIT_COMMIT_SHA: ${{ github.sha }}
7
+ GIT_BRANCH: ${{ github.ref }}
8
+
9
+ jobs:
10
+ linting:
11
+ runs-on: ubuntu-latest
12
+ env:
13
+ BUNDLE_WITH: lint
14
+ BUNDLE_WITHOUT: development:test
15
+
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+
19
+ - name: Set up Ruby 2.7
20
+ uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: 2.7
23
+ bundler-cache: true
24
+
25
+ - name: Rubocop
26
+ run: bundle exec rubocop --format progress
27
+
28
+ build:
29
+ needs: [linting]
30
+ runs-on: ubuntu-latest
31
+ name: build (ruby v${{ matrix.ruby }})
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ ruby: ["2.5", "2.6", "2.7", "3.0", "3.1"]
36
+
37
+ steps:
38
+ - uses: actions/checkout@v2
39
+ - uses: ruby/setup-ruby@v1
40
+ with:
41
+ ruby-version: ${{ matrix.ruby }}
42
+ bundler-cache: true
43
+
44
+ - name: Test
45
+ continue-on-error: ${{ matrix.experimental }}
46
+ run: bundle exec rake test
data/.gitignore CHANGED
@@ -11,27 +11,11 @@
11
11
  /tmp/
12
12
 
13
13
  # Used by dotenv library to load environment variables.
14
- # .env
14
+ .env
15
15
 
16
16
  # Ignore Byebug command history file.
17
17
  .byebug_history
18
18
 
19
- ## Specific to RubyMotion:
20
- .dat*
21
- .repl_history
22
- build/
23
- *.bridgesupport
24
- build-iPhoneOS/
25
- build-iPhoneSimulator/
26
-
27
- ## Specific to RubyMotion (use of CocoaPods):
28
- #
29
- # We recommend against adding the Pods directory to your .gitignore. However
30
- # you should judge for yourself, the pros and cons are mentioned at:
31
- # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
32
- #
33
- # vendor/Pods/
34
-
35
19
  ## Documentation cache and generated files:
36
20
  /.yardoc/
37
21
  /_yardoc/
@@ -46,11 +30,15 @@ build-iPhoneSimulator/
46
30
  # for a library or gem, you might want to ignore these files since the code is
47
31
  # intended to run in multiple environments; otherwise, check them in:
48
32
  # Gemfile.lock
49
- # .ruby-version
50
- # .ruby-gemset
33
+ .ruby-version
34
+ .ruby-gemset
51
35
 
52
36
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
53
37
  .rvmrc
54
38
 
55
39
  # Used by RuboCop. Remote config files pulled in from inherit_from directive.
56
40
  # .rubocop-https?--*
41
+
42
+ # IDE and system files
43
+ .vscode/
44
+ **/.DS_STORE
data/.rubocop.yml ADDED
@@ -0,0 +1,159 @@
1
+ # The behavior of RuboCop can be controlled via the .rubocop.yml
2
+ # configuration file. It makes it possible to enable/disable
3
+ # certain cops (checks) and to alter their behavior if they accept
4
+ # any parameters. The file can be placed either in your home
5
+ # directory or in some project directory.
6
+ #
7
+ # RuboCop will start looking for the configuration file in the directory
8
+ # where the inspected file is and continue its way up to the root directory.
9
+ #
10
+ # See https://docs.rubocop.org/rubocop/configuration
11
+
12
+ # General
13
+ AllCops:
14
+ NewCops: enable
15
+ SuggestExtensions: false
16
+
17
+ # Layout
18
+ Layout/BlockAlignment:
19
+ Enabled: true
20
+ EnforcedStyleAlignWith: start_of_block
21
+
22
+ Layout/ClassStructure:
23
+ Enabled: true
24
+
25
+ Layout/DotPosition:
26
+ Enabled: true
27
+ EnforcedStyle: leading
28
+
29
+ Layout/FirstArrayElementIndentation:
30
+ Enabled: true
31
+ EnforcedStyle: consistent
32
+
33
+ Layout/FirstHashElementIndentation:
34
+ Enabled: true
35
+ EnforcedStyle: consistent
36
+
37
+ Layout/HashAlignment:
38
+ Enabled: true
39
+ EnforcedColonStyle: key
40
+ EnforcedLastArgumentHashStyle: always_inspect
41
+
42
+ Layout/LineEndStringConcatenationIndentation:
43
+ Enabled: true
44
+ EnforcedStyle: aligned
45
+
46
+ Layout/LineLength:
47
+ Enabled: true
48
+ Max: 120
49
+
50
+ Layout/MultilineArrayLineBreaks:
51
+ Enabled: true
52
+
53
+ Layout/MultilineAssignmentLayout:
54
+ Enabled: false
55
+
56
+ Layout/MultilineHashKeyLineBreaks:
57
+ Enabled: true
58
+
59
+ Layout/MultilineMethodArgumentLineBreaks:
60
+ Enabled: true
61
+
62
+ Layout/MultilineMethodCallIndentation:
63
+ Enabled: true
64
+ EnforcedStyle: indented_relative_to_receiver
65
+
66
+ Layout/MultilineOperationIndentation:
67
+ Enabled: true
68
+ EnforcedStyle: indented
69
+
70
+ Layout/ParameterAlignment:
71
+ Enabled: true
72
+ EnforcedStyle: with_first_parameter
73
+
74
+ Layout/RedundantLineBreak:
75
+ Enabled: true
76
+ InspectBlocks: false
77
+
78
+ Layout/SingleLineBlockChain:
79
+ Enabled: false
80
+
81
+ Layout/SpaceBeforeBrackets:
82
+ Enabled: true
83
+
84
+ Layout/TrailingEmptyLines:
85
+ Enabled: true
86
+ EnforcedStyle: final_newline
87
+
88
+ # Lint
89
+ Lint/AmbiguousAssignment:
90
+ Enabled: true
91
+
92
+ Lint/AmbiguousOperatorPrecedence:
93
+ Enabled: true
94
+
95
+ Lint/AmbiguousRange:
96
+ Enabled: true
97
+
98
+ # Metrics
99
+ Metrics/AbcSize:
100
+ Max: 20
101
+ Exclude:
102
+ - "test/**/*"
103
+
104
+ Metrics/ClassLength:
105
+ Max: 150
106
+ CountAsOne:
107
+ - array
108
+ - hash
109
+ - heredoc
110
+ Exclude:
111
+ - "test/**/*"
112
+
113
+ Metrics/MethodLength:
114
+ Max: 20
115
+ CountAsOne:
116
+ - array
117
+ - hash
118
+ - heredoc
119
+ Exclude:
120
+ - "test/**/*"
121
+
122
+ # Naming
123
+ Naming/InclusiveLanguage:
124
+ Enabled: true
125
+
126
+ Naming/VariableNumber:
127
+ EnforcedStyle: snake_case
128
+
129
+ # Style
130
+ Style/AndOr:
131
+ EnforcedStyle: always
132
+
133
+ Style/ArrayCoercion:
134
+ Enabled: true
135
+
136
+ Style/CollectionCompact:
137
+ Enabled: true
138
+
139
+ Style/ConstantVisibility:
140
+ Enabled: true
141
+ IgnoreModules: true
142
+
143
+ Style/Documentation:
144
+ Exclude:
145
+ - "test/**/*"
146
+
147
+ Style/DocumentationMethod:
148
+ Enabled: true
149
+ Exclude:
150
+ - "test/**/*"
151
+
152
+ Style/SelectByRegexp:
153
+ Enabled: false
154
+
155
+ Style/SwapValues:
156
+ Enabled: true
157
+
158
+ Style/TrailingCommaInArrayLiteral:
159
+ EnforcedStyleForMultiline: comma
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ -o ./docs - LICENSE
data/CHANGELOG.md CHANGED
@@ -0,0 +1,63 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## Unreleased
8
+
9
+ N/A
10
+
11
+ ## [1.1.0](https://github.com/clarkedb/grift/releases/tag/v1.1.0) - 2022-02-03
12
+
13
+ This version adds support for Ruby 3.1 and updates various dependencies.
14
+
15
+ ### Added
16
+
17
+ * Support Ruby 3.1
18
+
19
+ ### Updated
20
+
21
+ * Updates `minitest`
22
+ * Updates `minitest-reporters`
23
+ * Updates `rubocop`
24
+ * Updates `rubocop-minitest`
25
+ * Updates `rubocop-performance`
26
+
27
+ ## [1.0.2](https://github.com/clarkedb/grift/releases/tag/v1.0.2) - 2021-11-11
28
+
29
+ This version fixes a bug that prevented the mocking of methods defined by a class's super class.
30
+
31
+ ### Fixed
32
+
33
+ * Allow mocks of inherited methods
34
+
35
+ ## [1.0.1](https://github.com/clarkedb/grift/releases/tag/v1.0.1) - 2021-11-10
36
+
37
+ This version fixes a bug that prevented most mocking features in Grift from functioning as expected.
38
+
39
+ ### Fixed
40
+
41
+ * Uses relative path for yaml config files
42
+
43
+ ### Updated
44
+
45
+ * Updates `rubocop-performance`
46
+ * Updates `rake`
47
+
48
+ ## [1.0.0](https://github.com/clarkedb/grift/releases/tag/v1.0.0) - 2021-11-06
49
+
50
+ The first major version of Grift! 100% documentation and 100% code coverage.
51
+
52
+ ### Added
53
+
54
+ * Spying on method
55
+ * Mocking method return values
56
+ * Mocking method implementation
57
+ * Restricted methods that cannot be mocked
58
+ * MiniTest Plugin to use hooks and clean up after tests
59
+ * Documentation!
60
+
61
+ ## [0.1.0](https://github.com/clarkedb/grift/releases/tag/v0.1.0) - 2021-10-12
62
+
63
+ The initial version of Grift. This was never intended for use and should be considered **deprecated**.
data/Gemfile CHANGED
@@ -1,7 +1,21 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
2
 
3
- # Specify your gem's dependencies in grift.gemspec
3
+ source 'https://rubygems.org'
4
+
5
+ # Grift's gem dependencies are defined in grift.gemspec
4
6
  gemspec
5
7
 
6
- gem "minitest", "~> 5.0"
7
- gem "rake", "~> 12.0"
8
+ gem 'rake', '>= 12.0'
9
+
10
+ group :development, :test do
11
+ gem 'minitest', '>= 5.0'
12
+ gem 'minitest-reporters', '>= 1.4.3'
13
+ gem 'simplecov', '>= 0.21.2'
14
+ end
15
+
16
+ group :development, :lint do
17
+ gem 'rubocop'
18
+ gem 'rubocop-minitest'
19
+ gem 'rubocop-packaging', '>= 0.5'
20
+ gem 'rubocop-performance', '>= 1.0'
21
+ end
data/Gemfile.lock CHANGED
@@ -1,21 +1,68 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- grift (0.1.0)
4
+ grift (1.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- minitest (5.14.4)
10
- rake (12.3.3)
9
+ ansi (1.5.0)
10
+ ast (2.4.2)
11
+ builder (3.2.4)
12
+ docile (1.4.0)
13
+ minitest (5.15.0)
14
+ minitest-reporters (1.5.0)
15
+ ansi
16
+ builder
17
+ minitest (>= 5.0)
18
+ ruby-progressbar
19
+ parallel (1.21.0)
20
+ parser (3.1.0.0)
21
+ ast (~> 2.4.1)
22
+ rainbow (3.1.1)
23
+ rake (13.0.6)
24
+ regexp_parser (2.2.0)
25
+ rexml (3.2.5)
26
+ rubocop (1.25.1)
27
+ parallel (~> 1.10)
28
+ parser (>= 3.1.0.0)
29
+ rainbow (>= 2.2.2, < 4.0)
30
+ regexp_parser (>= 1.8, < 3.0)
31
+ rexml
32
+ rubocop-ast (>= 1.15.1, < 2.0)
33
+ ruby-progressbar (~> 1.7)
34
+ unicode-display_width (>= 1.4.0, < 3.0)
35
+ rubocop-ast (1.15.1)
36
+ parser (>= 3.0.1.1)
37
+ rubocop-minitest (0.17.1)
38
+ rubocop (>= 0.90, < 2.0)
39
+ rubocop-packaging (0.5.1)
40
+ rubocop (>= 0.89, < 2.0)
41
+ rubocop-performance (1.13.2)
42
+ rubocop (>= 1.7.0, < 2.0)
43
+ rubocop-ast (>= 0.4.0)
44
+ ruby-progressbar (1.11.0)
45
+ simplecov (0.21.2)
46
+ docile (~> 1.1)
47
+ simplecov-html (~> 0.11)
48
+ simplecov_json_formatter (~> 0.1)
49
+ simplecov-html (0.12.3)
50
+ simplecov_json_formatter (0.1.3)
51
+ unicode-display_width (2.1.0)
11
52
 
12
53
  PLATFORMS
13
54
  ruby
14
55
 
15
56
  DEPENDENCIES
16
57
  grift!
17
- minitest (~> 5.0)
18
- rake (~> 12.0)
58
+ minitest (>= 5.0)
59
+ minitest-reporters (>= 1.4.3)
60
+ rake (>= 12.0)
61
+ rubocop
62
+ rubocop-minitest
63
+ rubocop-packaging (>= 0.5)
64
+ rubocop-performance (>= 1.0)
65
+ simplecov (>= 0.21.2)
19
66
 
20
67
  BUNDLED WITH
21
68
  2.1.4
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Grift
2
2
 
3
+ [![gem version](https://badge.fury.io/rb/grift.svg)](https://rubygems.org/gems/grift)
4
+ [![downloads](https://ruby-gem-downloads-badge.herokuapp.com/grift)](https://rubygems.org/gems/grift)
5
+ [![build](https://github.com/clarkedb/grift/actions/workflows/ci.yml/badge.svg)](https://github.com/clarkedb/grift/actions?query=workflow%3ACI)
6
+
3
7
  Mocking and spying in Ruby's MiniTest framework
4
8
 
5
9
  ## Installation
@@ -22,16 +26,100 @@ Or install it yourself as:
22
26
  gem install grift
23
27
  ```
24
28
 
29
+ ### MiniTest Plugin
30
+
31
+ We recommend using the plugin so that mocks are cleaned up after each test automatically. To enable the plugin, add the following lines of code to your `test_helper` file.
32
+
33
+ ```ruby
34
+ class Minitest::Test
35
+ include Grift::MinitestPlugin
36
+ end
37
+ ```
38
+
39
+ Or for Ruby on Rails:
40
+
41
+ ```ruby
42
+ class ActiveSupport::TestCase
43
+ include Grift::MinitestPlugin
44
+ end
45
+ ```
46
+
25
47
  ## Usage
26
48
 
27
- TODO: Write usage instructions here
49
+ For complete usage guide, see the [docs](https://clarkedb.github.io/grift/).
50
+
51
+ ### Spy
52
+
53
+ To "mock" a method and spy on its call args and results without changing the behavior of the method:
54
+
55
+ ```ruby
56
+ my_mock = Grift.spy_on(MyClass, :my_method)
57
+ ```
58
+
59
+ ### Mock
60
+
61
+ To mock a method and its return value:
62
+
63
+ ```ruby
64
+ my_mock = Grift.mock(MyClass, :my_method, return_value)
65
+
66
+ my_spy = Grift.spy_on(MyClass, :my_method)
67
+ my_spy.mock_return_value(return_value)
68
+ ```
69
+
70
+ To mock the implementation:
71
+
72
+ ```ruby
73
+ my_spy = Grift.spy_on(MyClass, :my_method)
74
+ my_spy.mock_implementation do |arg1, arg2|
75
+ x = do_something(arg1, arg2)
76
+ do_something_else(x) # the last line will be returned
77
+ end
78
+ ```
79
+
80
+ ### Chaining
81
+
82
+ You can chain `mock_return_value` and `mock_implementation` after initializing the mock.
83
+
84
+ ```ruby
85
+ my_mock = Grift.spy_on(MyClass, :my_method).mock_implementation do |*args|
86
+ do_something(*args)
87
+ end
88
+ #=> Grift::MockMethod object is returned
89
+ ```
90
+
91
+ ### Results
92
+
93
+ To get the results and details of the calls, call `mock` on your mock method object.
94
+
95
+ ```ruby
96
+ # get the number of times the mocked method has been called
97
+ my_mock.mock.count
98
+ #=> 2
99
+
100
+ # get args for each call to the method while mocked
101
+ my_mock.mock.calls
102
+ #=> [['first_arg1', 'second_arg1'], ['first_arg2', 'second_arg2']]
103
+
104
+ # get results (return value) for each call to the method while mocked
105
+ my_mock.mock.results
106
+ #=> ['result1', 'result2']
107
+ ```
108
+
109
+ ## Requirements
110
+
111
+ Grift supports all Ruby versions >= 2.5 (including 3.1).
28
112
 
29
113
  ## Development
30
114
 
31
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
115
+ After forking the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
116
+
117
+ When developing, to install Grift whith your changes onto your local machine, run `bundle exec rake install` . To release a new version, update the version number in `version.rb` , and then run `bundle exec rake release` , which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
118
+
119
+ ### Docs
32
120
 
33
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
121
+ The docs are generated using YARD. To build the docs, first `gem install yard`. Then run `yardoc` to build the new docs. This is always done before a release to update the docs that get published and made available with the gem.
34
122
 
35
123
  ## Contributing
36
124
 
37
- Bug reports and pull requests are welcome on GitHub at [clarkedb/grift](https://github.com/clarkedb/grift).
125
+ Bug reports and pull requests are welcome on GitHub at [clarkedb/grift](https://github.com/clarkedb/grift). Before submitting a pull request, see [CONTRIBUTING](.github/CONTRIBUTING.md).
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'grift'
data/grift.gemspec CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'lib/grift/version'
2
4
 
3
5
  Gem::Specification.new do |spec|
@@ -17,6 +19,7 @@ Gem::Specification.new do |spec|
17
19
  'changelog_uri' => "#{spec.homepage}/blob/main/CHANGELOG.md",
18
20
  'documentation_uri' => spec.homepage.to_s,
19
21
  'homepage_uri' => spec.homepage.to_s,
22
+ 'rubygems_mfa_required' => 'true',
20
23
  'source_code_uri' => spec.homepage.to_s
21
24
  }
22
25
 
@@ -0,0 +1,31 @@
1
+ Grift:
2
+ - "*"
3
+
4
+ Minitest:
5
+ - "*"
6
+
7
+ # ruby classes
8
+ Array:
9
+ - count
10
+ - empty?
11
+ - include?
12
+ - map
13
+ - push
14
+
15
+ Class:
16
+ - "*"
17
+
18
+ Hash:
19
+ - "[]"
20
+ - "[]="
21
+ - include?
22
+ - select
23
+
24
+ String:
25
+ - "=="
26
+ - "[]"
27
+ - to_sym
28
+
29
+ Symbol:
30
+ - "=="
31
+ - to_s
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yaml'
4
+
5
+ module Grift
6
+ ##
7
+ # The config for Grift. This is readonly for now.
8
+ #
9
+ module Config
10
+ restricted_file_path = File.join(File.dirname(__FILE__), 'config/restricted.yml')
11
+ @restricted_methods = YAML.safe_load(File.read(restricted_file_path))
12
+
13
+ class << self
14
+ ##
15
+ # The restricted methods as a hash organized by class as the key and then the
16
+ # methods in an array as the value. A '*' means all methods are restricted.
17
+ # A '^' preceding a method overrides the wildcard restriction.
18
+ #
19
+ # @example
20
+ # Grift::Config.restricted_methods
21
+ # #=> { 'Class' => ['method1', ...], ... }
22
+ #
23
+ # @return [Hash] the restricted methods organized by class
24
+ #
25
+ attr_reader :restricted_methods
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Grift
4
+ ##
5
+ # The error used for all of Grift.
6
+ #
7
+ class Error < StandardError; end
8
+ end