nydp 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lisp/tests/string-tests.nydp +14 -0
- data/lib/nydp/builtin/string_replace.rb +2 -2
- data/lib/nydp/core_ext.rb +4 -1
- data/lib/nydp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adb6cc0345ed64c1e0e7ac99c06d9aa1328482e7d51d771cd77b844e1c5a6e14
|
4
|
+
data.tar.gz: 997c1f318ed518f3d2100699c1532db9a140f7109d6e4ddef6e68055466eb23a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a80109cc7bf73c177c6f89697e386a0a12d3645512bd14db2ed036711ef2c0b11d80fef67cff8dbc6f7bfed23d103220b9bc909aa9b34590323375db699c5e3
|
7
|
+
data.tar.gz: 25864fdef654329baef7d494a54b926f6dd236399f131e5943505752784713b03dc9e79640407c1df6af17ac380c483d82e2fae5e35fa3f3636b1226384eaa58
|
@@ -72,8 +72,22 @@ and args (\"world\" 36 6)"
|
|
72
72
|
(string-replace "and" "or" "a and b and c and d")
|
73
73
|
"a or b or c or d")
|
74
74
|
|
75
|
+
("replaces with hash lookup"
|
76
|
+
(string-replace
|
77
|
+
"['<>&\"]"
|
78
|
+
{ "'" "'"
|
79
|
+
"<" "<"
|
80
|
+
">" ">"
|
81
|
+
"\"" """ }
|
82
|
+
"it's >such< a \"lovely\" day")
|
83
|
+
"it's >such< a "lovely" day")
|
84
|
+
|
75
85
|
("replace with regexp"
|
76
86
|
(string-replace "and|or" "x" "a and b or c and d")
|
87
|
+
"a x b x c x d")
|
88
|
+
|
89
|
+
("replace with literal regexp"
|
90
|
+
(string-replace (regexp "and|or") "x" "a and b or c and d")
|
77
91
|
"a x b x c x d"))
|
78
92
|
|
79
93
|
(examples-for string-truncate
|
@@ -2,8 +2,8 @@ class Nydp::Builtin::StringReplace
|
|
2
2
|
include Nydp::Builtin::Base, Singleton
|
3
3
|
|
4
4
|
def builtin_invoke vm, args
|
5
|
-
to_remove = Regexp.new args.car.
|
6
|
-
to_insert = args.cdr.car.
|
5
|
+
to_remove = Regexp.new args.car.to_ruby
|
6
|
+
to_insert = args.cdr.car.to_ruby
|
7
7
|
target = args.cdr.cdr.car.to_s
|
8
8
|
result = target.to_s.gsub to_remove, to_insert
|
9
9
|
|
data/lib/nydp/core_ext.rb
CHANGED
@@ -39,11 +39,14 @@ class ::Array
|
|
39
39
|
def _nydp_wrapper ; Nydp::Pair.from_list map &:_nydp_wrapper ; end
|
40
40
|
end
|
41
41
|
|
42
|
+
class ::Object
|
43
|
+
def to_ruby ; self ; end
|
44
|
+
end
|
45
|
+
|
42
46
|
class ::String
|
43
47
|
# def _nydp_wrapper ; Nydp::StringAtom.new self ; end
|
44
48
|
def as_method_name ; self.gsub(/-/, '_').to_sym ; end
|
45
49
|
def nydp_type ; :string ; end
|
46
|
-
def to_ruby ; self ; end
|
47
50
|
end
|
48
51
|
|
49
52
|
class ::Hash
|
data/lib/nydp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nydp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Conan Dalton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|