ruby_like_clojure 0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 69ae060a00a4b9259b4663ec136ea415f8f4763edd43c6f712a3c930603f1732
4
+ data.tar.gz: 22263fa679fb661474050b9b1984430647e40248a33af08077b03015f1242688
5
+ SHA512:
6
+ metadata.gz: 387b381fb5852dbc89c6c0ef3c5f70beb426c28fc81413cfac458610e2ae1082bceb9f79c6d9c0275c6bba2ba88ef162aae60833204abea3299a013e49297875
7
+ data.tar.gz: fba578ed4960cb886861f833149612a4988d3e6cf19391f31c460ac57b2c2c0c381086f93f53ab91e7121fa3e6bbfed4cb87f9e6a789415d039b50b7a288f905
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Dan Sudol
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,12 @@
1
+ All your favorite functions that act on maps/hashes in clojure, but for ruby
2
+ like:
3
+
4
+ assoc_in
5
+
6
+ update_in
7
+
8
+ update
9
+
10
+ get_in
11
+
12
+ feel free to suggest other functions we can implement in ruby that you miss in clojure
@@ -0,0 +1,26 @@
1
+ module RLC
2
+ def self.assoc_in(hash, path, value)
3
+ first, *rest = path
4
+ if rest.empty?
5
+ if hash.is_a? Array
6
+ hash.dup.tap { |new_array| new_array[first] = value }
7
+ else
8
+ hash.merge(first => value)
9
+ end
10
+ else
11
+ hash.merge(first => assoc_in(hash.fetch(first, {}), rest, value))
12
+ end
13
+ end
14
+
15
+ def self.update(target, key)
16
+ target.merge(key => yield(target[key]))
17
+ end
18
+
19
+ def self.update_in(target, path)
20
+ assoc_in(target, path, yield(target.dig(*path)))
21
+ end
22
+
23
+ def self.get_in(hash, path, default = nil)
24
+ hash.dig(*path) || default
25
+ end
26
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyLikeClojure
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,7 @@
1
+ require_relative "ruby_like_clojure/version"
2
+ require_relative "ruby_like_clojure/core"
3
+
4
+ module RubyLikeClojure
5
+ class Error < StandardError; end
6
+ # Your code goes here...
7
+ end
metadata ADDED
@@ -0,0 +1,52 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby_like_clojure
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Dan Sudol
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2025-05-24 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Clojure functions implemented in Ruby.
14
+ email:
15
+ - dansudol@yahoo.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - LICENSE.txt
21
+ - README.md
22
+ - lib/ruby_like_clojure.rb
23
+ - lib/ruby_like_clojure/core.rb
24
+ - lib/ruby_like_clojure/version.rb
25
+ homepage: http://www.github.com/danielsudol/ruby_like_clojure
26
+ licenses:
27
+ - MIT
28
+ metadata:
29
+ allowed_push_host: https://rubygems.org
30
+ homepage_uri: http://www.github.com/danielsudol/ruby_like_clojure
31
+ source_code_uri: http://www.github.com/danielsudol/ruby_like_clojure
32
+ changelog_uri: http://www.github.com/danielsudol/ruby_like_clojure/CHANGELOG.md
33
+ post_install_message:
34
+ rdoc_options: []
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: 3.1.0
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ requirements: []
48
+ rubygems_version: 3.5.22
49
+ signing_key:
50
+ specification_version: 4
51
+ summary: Clojure functions implemented in Ruby.
52
+ test_files: []