nydp 0.5.0 → 0.5.1

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: '0389044de6d7b6230da9315bc8dde967e1ddf8ed77df2b8ef4106ce9bfc3e93a'
4
- data.tar.gz: 133567982e2fbb734ea429e98197e4b7d5bc49c2130f64ec630c095adcd1f250
3
+ metadata.gz: adb6cc0345ed64c1e0e7ac99c06d9aa1328482e7d51d771cd77b844e1c5a6e14
4
+ data.tar.gz: 997c1f318ed518f3d2100699c1532db9a140f7109d6e4ddef6e68055466eb23a
5
5
  SHA512:
6
- metadata.gz: 2516bbc0473796915710786bb8b43ac339df657438e5a35d8f8d38cb5a7b46c1663b09a8cea266369b168530b63a1f249daf882d2712cd8558febb167bc648ef
7
- data.tar.gz: 2548a1e1259f053ff25bc490d13f44579720be5f0ea7954915917092a04d0619f0b014221f55ed6b1f86f5046f5a6a7244348ff4805a2282ece150c3993be71f
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
+ { "'" "&#39;"
79
+ "<" "&lt;"
80
+ ">" "&gt;"
81
+ "\"" "&quot;" }
82
+ "it's >such< a \"lovely\" day")
83
+ "it&#39;s &gt;such&lt; a &quot;lovely&quot; 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.to_s
6
- to_insert = args.cdr.car.to_s
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
@@ -1,3 +1,3 @@
1
1
  module Nydp
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
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.0
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-03-31 00:00:00.000000000 Z
11
+ date: 2021-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake