syn 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/syn.rb +56 -0
  3. metadata +43 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2f8f45b08caf0886c124323c80aa9691f56002ed
4
+ data.tar.gz: f172c9811313cb982b3b4d210000313627adf0df
5
+ SHA512:
6
+ metadata.gz: ab71f1ab104b6ea9387c66ba39ca4c3fdb6892be69685aa8a91cfd2cc71a7d65ca9ba82c158b2d4d1404c79459acde5dd943e3d096507520171788ce90b86b51
7
+ data.tar.gz: ca84397d7c3803d3e6e87622b5686590e384cab5c174a80ac9695cc926ecc4d3dbb015a268c99799117cb654d8d6cc6bf68949e50b540b71f8a47d518bf100ac
@@ -0,0 +1,56 @@
1
+ module Syn
2
+
3
+ module Literal
4
+ attr_reader :string
5
+
6
+ def string= object
7
+ @string = object.to_s
8
+ end
9
+
10
+ def to_s
11
+ @string
12
+ end
13
+
14
+ class Array
15
+ include Literal
16
+
17
+ def initialize
18
+ @elements = []
19
+ end
20
+
21
+ def []= index, value
22
+ @elements[index] = value
23
+ end
24
+
25
+ def to_s
26
+ "[#{@elements.join ', '}]"
27
+ end
28
+ end
29
+
30
+ class Name
31
+ include Literal
32
+ end
33
+
34
+ class String
35
+ include Literal
36
+
37
+ def to_s
38
+ "\"#{@string}\""
39
+ end
40
+ end
41
+
42
+ class Symbol
43
+ include Literal
44
+
45
+ def string= object
46
+ string = object.to_s
47
+
48
+ @string = if string.match /\s/
49
+ ":\"#{string}\""
50
+ else
51
+ ":#{string}"
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: syn
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Anatoly Chernow
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-08-30 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/syn.rb
20
+ homepage:
21
+ licenses: []
22
+ metadata: {}
23
+ post_install_message:
24
+ rdoc_options: []
25
+ require_paths:
26
+ - lib
27
+ required_ruby_version: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: '0'
32
+ required_rubygems_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ requirements: []
38
+ rubyforge_project:
39
+ rubygems_version: 2.6.13
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: Syntactic Ruby objects.
43
+ test_files: []