From 42645c985d3ce51e6065a1ca6051cbed34b2c777 Mon Sep 17 00:00:00 2001 From: Reegan Viljoen <62689748+reeganviljoen@users.noreply.github.com> Date: Fri, 1 Sep 2023 08:21:23 +0200 Subject: [PATCH] Revert "add: version 2" --- .github/workflows/ci.yml | 25 ---------------- Gemfile.lock | 7 ++--- README.md | 30 +++++++++---------- lib/proc_eval/version.rb | 3 -- lib/{proc_eval.rb => proc_evaluate.rb} | 4 +-- lib/proc_evaluate/version.rb | 3 ++ proc_eval.gemspec => proc_evaluate.gemspec | 14 ++++----- ...est_proc_eval.rb => test_proc_evaluate.rb} | 10 +++---- 8 files changed, 35 insertions(+), 61 deletions(-) delete mode 100644 .github/workflows/ci.yml delete mode 100644 lib/proc_eval/version.rb rename lib/{proc_eval.rb => proc_evaluate.rb} (96%) create mode 100644 lib/proc_evaluate/version.rb rename proc_eval.gemspec => proc_evaluate.gemspec (82%) rename test/{test_proc_eval.rb => test_proc_evaluate.rb} (90%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index a8ef1ac..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: CI - -on: [push, pull_request] - -jobs: - build: - runs-on: ubuntu-latest - name: Ruby ${{ matrix.ruby }} - strategy: - matrix: - include: - - ruby_version: "2.7" - - ruby_version: "3.0" - - ruby-version: "3.1" - - ruby-version: "3.2" - - steps: - - uses: actions/checkout@v3 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby_version }} - bundler-cache: true - - name: Run the default task - run: bundle exec rake diff --git a/Gemfile.lock b/Gemfile.lock index e3e374f..aa755c2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - proc_eval (2.0.0) + proc_evaluate (1.0.0) GEM remote: https://rubygems.org/ @@ -10,13 +10,12 @@ GEM rake (13.0.6) PLATFORMS - x86_64-darwin-21 x86_64-linux DEPENDENCIES minitest (~> 5.0) - proc_eval! + proc_evaluate! rake (~> 13.0) BUNDLED WITH - 2.4.8 + 2.3.14 diff --git a/README.md b/README.md index 7d2ed3c..e839d70 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ProcEval +# ProcEvaluate This ruby gem adds an `evaulate` method to Proc and Object instances through the use of [Refinements][1]. @@ -44,19 +44,19 @@ Because this gem makes use of keyword parameters and refinements, it is only com ## Usage -In your `Gemfile` add `gem 'proc_eval'`. +In your `Gemfile` add `gem 'proc_evaluate'`. -In your codebase add `require 'proc_eval'`. +In your codebase add `require 'proc_evaluate'`. -The refinement methods in the gem can be used by including `using ProcEval` in the file, **class** definition, or **module** definition in which you wish to use the [refinement][1]. +The refinement methods in the gem can be used by including `using ProcEvaluate` in the file, **class** definition, or **module** definition in which you wish to use the [refinement][1]. ### Class and Module usage The refinement methods can be activated for use within a specific Class or Module. ```ruby -class ProcEvalClassExamples - using ProcEval +class ProcEvaluateClassExamples + using ProcEvaluate def example1 a = ->(a) { a } @@ -79,14 +79,14 @@ class ProcEvalClassExamples end end -e = ProcEvalClassExamples.new +e = ProcEvaluateClassExamples.new e.example1 # "hello" e.example2 # [1, 2, 3, 4, nil, nil, nil] e.example3 # "Im a proc!!!" e.example4 # "im a value!!!" -module ProcEvalModuleExamples - using ProcEval +module ProcEvaluateModuleExamples + using ProcEvaluate extend self def example1 @@ -110,17 +110,17 @@ module ProcEvalModuleExamples end end -ProcEvalModuleExamples.example1 # "hello" -ProcEvalModuleExamples.example2 # [1, 2, 3, 4, nil, nil, nil] -ProcEvalModuleExamples.example3 # "Im a proc!!!" -ProcEvalModuleExamples.example4 # "im a value!!!" +ProcEvaluateModuleExamples.example1 # "hello" +ProcEvaluateModuleExamples.example2 # [1, 2, 3, 4, nil, nil, nil] +ProcEvaluateModuleExamples.example3 # "Im a proc!!!" +ProcEvaluateModuleExamples.example4 # "im a value!!!" ``` Another example showing a different pattern of usage: ```ruby class Example - using ProcEval + using ProcEvaluate def initialize(value) @value = value @@ -165,7 +165,7 @@ To test the example, place the code into a file and run with the command `ruby e ```ruby # example.rb -using ProcEval # activate the refinements for the current file +using ProcEvaluate # activate the refinements for the current file proc = proc {|a, b, c| [a, b, c] } proc.evaluate() # [nil, nil, nil] diff --git a/lib/proc_eval/version.rb b/lib/proc_eval/version.rb deleted file mode 100644 index 81bbf8f..0000000 --- a/lib/proc_eval/version.rb +++ /dev/null @@ -1,3 +0,0 @@ -module ProcEval - VERSION = '2.0.0' -end diff --git a/lib/proc_eval.rb b/lib/proc_evaluate.rb similarity index 96% rename from lib/proc_eval.rb rename to lib/proc_evaluate.rb index f0c461d..8d7a174 100644 --- a/lib/proc_eval.rb +++ b/lib/proc_evaluate.rb @@ -1,4 +1,4 @@ -module ProcEval +module ProcEvaluate refine Object do def evaluate(*args, **options) @@ -59,4 +59,4 @@ def evaluate(*args, **options) end # refine Proc end -require 'proc_eval/version' +require 'proc_evaluate/version' diff --git a/lib/proc_evaluate/version.rb b/lib/proc_evaluate/version.rb new file mode 100644 index 0000000..9b5f2eb --- /dev/null +++ b/lib/proc_evaluate/version.rb @@ -0,0 +1,3 @@ +module ProcEvaluate + VERSION = '1.0.0' +end diff --git a/proc_eval.gemspec b/proc_evaluate.gemspec similarity index 82% rename from proc_eval.gemspec rename to proc_evaluate.gemspec index 9758d9d..ff28af7 100644 --- a/proc_eval.gemspec +++ b/proc_evaluate.gemspec @@ -1,11 +1,11 @@ -require_relative 'lib/proc_eval/version.rb' +require_relative 'lib/proc_evaluate/version.rb' Gem::Specification.new do |spec| - spec.name = 'proc_eval' - spec.version = ProcEval::VERSION + spec.name = 'proc_evaluate' + spec.version = ProcEvaluate::VERSION spec.authors = ['Brent Jacobs', 'br3nt'] - spec.homepage = 'https://github.com/reeganviljoen/proc_eval' - spec.required_ruby_version = '>= 2.7' + spec.homepage = 'https://github.com/br3nt/proc_evaluate' + spec.required_ruby_version = '>= 2.0' spec.summary = 'Allow evaluation of variables, procs, and lambdas with the same level of flexibility.' spec.description = <<-DESC Adds an `evaulate` refinement method to Proc and Object instances. @@ -28,7 +28,7 @@ Gem::Specification.new do |spec| spec.licenses = ['MIT'] spec.files = [ - 'lib/proc_eval.rb', - 'lib/proc_eval/version.rb' + 'lib/proc_evaluate.rb', + 'lib/proc_evaluate/version.rb' ] end diff --git a/test/test_proc_eval.rb b/test/test_proc_evaluate.rb similarity index 90% rename from test/test_proc_eval.rb rename to test/test_proc_evaluate.rb index 6b27016..490d948 100644 --- a/test/test_proc_eval.rb +++ b/test/test_proc_evaluate.rb @@ -1,8 +1,8 @@ require 'minitest/autorun' -require 'proc_eval' +require 'proc_evaluate' -class ProcEvalClassTest < Minitest::Test - using ProcEval +class ProcEvaluateClassTest < Minitest::Test + using ProcEvaluate def test_example1 lambda = ->(a) { a } @@ -31,7 +31,7 @@ def test_example4 end module TestModule - using ProcEval + using ProcEvaluate extend self def example1 @@ -55,7 +55,7 @@ def example4 end end -class ProcEvalModuleTest < Minitest::Test +class ProcEvaluateModuleTest < Minitest::Test def test_example1 value = TestModule.example1 assert_equal value, 'hello'