code-ruby-parser 0.1.8 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/code-ruby-parser.gemspec +3 -1
  3. data/lib/code-ruby-parser.rb +1 -7
  4. data/lib/template-ruby-parser.rb +1 -7
  5. data/template-ruby-parser.gemspec +3 -1
  6. metadata +18 -137
  7. data/.overcommit.yml +0 -4
  8. data/CHANGELOG.md +0 -35
  9. data/Gemfile +0 -5
  10. data/Gemfile.lock +0 -32
  11. data/bin/code-parser +0 -27
  12. data/bin/deploy +0 -16
  13. data/bin/format +0 -3
  14. data/bin/parse-docs +0 -6
  15. data/bin/template-parser +0 -27
  16. data/docs/class.code +0 -9
  17. data/docs/meetup.code +0 -14
  18. data/docs/precedence.code +0 -1
  19. data/docs/precedence.template +0 -35
  20. data/docs/rain.code +0 -23
  21. data/docs/slack.code +0 -17
  22. data/docs/stripe.code +0 -7
  23. data/docs/twitter.code +0 -7
  24. data/lib/code/parser/addition.rb +0 -13
  25. data/lib/code/parser/and_operator.rb +0 -13
  26. data/lib/code/parser/bitwise_and.rb +0 -13
  27. data/lib/code/parser/bitwise_or.rb +0 -13
  28. data/lib/code/parser/boolean.rb +0 -13
  29. data/lib/code/parser/call.rb +0 -183
  30. data/lib/code/parser/chained_call.rb +0 -41
  31. data/lib/code/parser/class.rb +0 -55
  32. data/lib/code/parser/code.rb +0 -20
  33. data/lib/code/parser/comments.rb +0 -46
  34. data/lib/code/parser/dictionnary.rb +0 -52
  35. data/lib/code/parser/equal.rb +0 -68
  36. data/lib/code/parser/equality.rb +0 -20
  37. data/lib/code/parser/error/syntax_error.rb +0 -36
  38. data/lib/code/parser/error.rb +0 -6
  39. data/lib/code/parser/function.rb +0 -118
  40. data/lib/code/parser/greater_than.rb +0 -13
  41. data/lib/code/parser/group.rb +0 -15
  42. data/lib/code/parser/if.rb +0 -81
  43. data/lib/code/parser/if_modifier.rb +0 -39
  44. data/lib/code/parser/list.rb +0 -20
  45. data/lib/code/parser/multiplication.rb +0 -13
  46. data/lib/code/parser/name.rb +0 -14
  47. data/lib/code/parser/negation.rb +0 -18
  48. data/lib/code/parser/not_keyword.rb +0 -26
  49. data/lib/code/parser/nothing.rb +0 -13
  50. data/lib/code/parser/number.rb +0 -57
  51. data/lib/code/parser/operation.rb +0 -65
  52. data/lib/code/parser/or_keyword.rb +0 -13
  53. data/lib/code/parser/or_operator.rb +0 -13
  54. data/lib/code/parser/power.rb +0 -33
  55. data/lib/code/parser/range.rb +0 -13
  56. data/lib/code/parser/rescue.rb +0 -38
  57. data/lib/code/parser/shift.rb +0 -13
  58. data/lib/code/parser/splat.rb +0 -35
  59. data/lib/code/parser/statement.rb +0 -9
  60. data/lib/code/parser/string.rb +0 -62
  61. data/lib/code/parser/ternary.rb +0 -73
  62. data/lib/code/parser/unary_minus.rb +0 -23
  63. data/lib/code/parser/while.rb +0 -36
  64. data/lib/code/parser.rb +0 -238
  65. data/lib/code.rb +0 -2
  66. data/lib/template/parser.rb +0 -32
  67. data/lib/template.rb +0 -2
  68. data/spec/code/parser/addition_spec.rb +0 -26
  69. data/spec/code/parser/and_operator_spec.rb +0 -26
  70. data/spec/code/parser/bitwise_and_spec.rb +0 -26
  71. data/spec/code/parser/bitwise_or_spec.rb +0 -26
  72. data/spec/code/parser/boolean_spec.rb +0 -13
  73. data/spec/code/parser/call_spec.rb +0 -52
  74. data/spec/code/parser/chained_call_spec.rb +0 -33
  75. data/spec/code/parser/class_spec.rb +0 -32
  76. data/spec/code/parser/code_spec.rb +0 -13
  77. data/spec/code/parser/dictionnary_spec.rb +0 -40
  78. data/spec/code/parser/equal_spec.rb +0 -42
  79. data/spec/code/parser/equality_spec.rb +0 -26
  80. data/spec/code/parser/function_spec.rb +0 -43
  81. data/spec/code/parser/greater_than_spec.rb +0 -26
  82. data/spec/code/parser/group_spec.rb +0 -13
  83. data/spec/code/parser/if_modifier_spec.rb +0 -26
  84. data/spec/code/parser/if_spec.rb +0 -39
  85. data/spec/code/parser/list_spec.rb +0 -27
  86. data/spec/code/parser/multiplication_spec.rb +0 -26
  87. data/spec/code/parser/negation_spec.rb +0 -13
  88. data/spec/code/parser/not_keyword_spec.rb +0 -21
  89. data/spec/code/parser/nothing_spec.rb +0 -20
  90. data/spec/code/parser/number_spec.rb +0 -24
  91. data/spec/code/parser/or_keyword_spec.rb +0 -26
  92. data/spec/code/parser/or_operator_spec.rb +0 -26
  93. data/spec/code/parser/power_spec.rb +0 -21
  94. data/spec/code/parser/range_spec.rb +0 -21
  95. data/spec/code/parser/rescue_spec.rb +0 -26
  96. data/spec/code/parser/shift_spec.rb +0 -26
  97. data/spec/code/parser/string_spec.rb +0 -28
  98. data/spec/code/parser/ternary_spec.rb +0 -26
  99. data/spec/code/parser/unary_minus_spec.rb +0 -21
  100. data/spec/code/parser/while_spec.rb +0 -32
  101. data/spec/code/parser_spec.rb +0 -13
  102. data/spec/spec_helper.rb +0 -6
  103. data/spec/template/parser_spec.rb +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4f1c3766c85835e0e849b956b2046e67d68c5f61ae462ad2bbcf436f194e8e6
4
- data.tar.gz: 22aaf2adc257c7d481d1be68cc8dafa366fd32aeb71764e7fcf14c94c140af7f
3
+ metadata.gz: 286a937501169ca16cb17cf07666da4b8f4e702e5c9a7160fd44552a8b69fa01
4
+ data.tar.gz: 10a70741c9ba16a6aedbd0bfbed9604e06d6be2ef28c1519db2761bf3b04be4e
5
5
  SHA512:
6
- metadata.gz: 1928d766297e5c755bccc6c6832ad056dd77638235738489488f733f2e44cba1c3d372b0873a97db577cf4ed40805c326c876ba0860ff3df186591093f23435b
7
- data.tar.gz: c49ba9bd87d69e3283f29553c03a5dbd474259ce2ade47d7f6f0b3da0bc36171f9355b39565d63ee6274ed6c30afad5f50db4879219772395e9170a18fde2abe
6
+ metadata.gz: 882ab4ca85f25f617b161e00dfb5895546ae205507bff002244d2e53d0c39abef25f670a35b2a3ebd677bf1018fd7eb34b331c5ea72f6fe63341a92131526c22
7
+ data.tar.gz: 0e33325f7eb57f459242c1e511e10f31ccff1ecb48bcbf775fcc5867c99e96163ff8420afbd7c64a0ad6e8f2e41fb4d75714e410364aa7ab24e874b6470f83a4
@@ -2,7 +2,7 @@ require_relative "lib/code-ruby-parser"
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "code-ruby-parser"
5
- s.version = ::Template::Parser::Version
5
+ s.version = "0.2.0"
6
6
  s.summary = "A parser for the Code programming language"
7
7
  s.description =
8
8
  "A parser for the Code programming language, like 1 + 1 and user.first_name"
@@ -13,4 +13,6 @@ Gem::Specification.new do |s|
13
13
  s.require_paths = ["lib"]
14
14
  s.homepage = "https://github.com/dorianmariefr/template-ruby-parser"
15
15
  s.license = "MIT"
16
+
17
+ s.add_dependency "code-ruby", "~> 0"
16
18
  end
@@ -1,7 +1 @@
1
- require "zeitwerk"
2
- require "forwardable"
3
-
4
- loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false)
5
- loader.ignore("#{__dir__}/template-ruby-parser.rb")
6
- loader.ignore("#{__dir__}/code-ruby-parser.rb")
7
- loader.setup
1
+ require "code-ruby"
@@ -1,7 +1 @@
1
- require "zeitwerk"
2
- require "forwardable"
3
-
4
- loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false)
5
- loader.ignore("#{__dir__}/template-ruby-parser.rb")
6
- loader.ignore("#{__dir__}/code-ruby-parser.rb")
7
- loader.setup
1
+ require "template-ruby"
@@ -2,7 +2,7 @@ require_relative "lib/template-ruby-parser"
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "template-ruby-parser"
5
- s.version = ::Template::Parser::Version
5
+ s.version = "0.2.0"
6
6
  s.summary = "A parser for the Template programming language"
7
7
  s.description =
8
8
  'Like "Hello {name}" with {name: "Dorian"} gives "Hello Dorian"'
@@ -13,4 +13,6 @@ Gem::Specification.new do |s|
13
13
  s.require_paths = ["lib"]
14
14
  s.homepage = "https://github.com/dorianmariefr/template-ruby-parser"
15
15
  s.license = "MIT"
16
+
17
+ s.add_dependency "template-ruby", "~> 0"
16
18
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code-ruby-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-13 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2022-11-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: code-ruby
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  description: A parser for the Code programming language, like 1 + 1 and user.first_name
14
28
  email: dorian@dorianmarie.fr
15
29
  executables: []
@@ -17,106 +31,9 @@ extensions: []
17
31
  extra_rdoc_files: []
18
32
  files:
19
33
  - ".gitignore"
20
- - ".overcommit.yml"
21
- - CHANGELOG.md
22
- - Gemfile
23
- - Gemfile.lock
24
- - bin/code-parser
25
- - bin/deploy
26
- - bin/format
27
- - bin/parse-docs
28
- - bin/template-parser
29
34
  - code-ruby-parser.gemspec
30
- - docs/class.code
31
- - docs/meetup.code
32
- - docs/precedence.code
33
- - docs/precedence.template
34
- - docs/rain.code
35
- - docs/slack.code
36
- - docs/stripe.code
37
- - docs/twitter.code
38
35
  - lib/code-ruby-parser.rb
39
- - lib/code.rb
40
- - lib/code/parser.rb
41
- - lib/code/parser/addition.rb
42
- - lib/code/parser/and_operator.rb
43
- - lib/code/parser/bitwise_and.rb
44
- - lib/code/parser/bitwise_or.rb
45
- - lib/code/parser/boolean.rb
46
- - lib/code/parser/call.rb
47
- - lib/code/parser/chained_call.rb
48
- - lib/code/parser/class.rb
49
- - lib/code/parser/code.rb
50
- - lib/code/parser/comments.rb
51
- - lib/code/parser/dictionnary.rb
52
- - lib/code/parser/equal.rb
53
- - lib/code/parser/equality.rb
54
- - lib/code/parser/error.rb
55
- - lib/code/parser/error/syntax_error.rb
56
- - lib/code/parser/function.rb
57
- - lib/code/parser/greater_than.rb
58
- - lib/code/parser/group.rb
59
- - lib/code/parser/if.rb
60
- - lib/code/parser/if_modifier.rb
61
- - lib/code/parser/list.rb
62
- - lib/code/parser/multiplication.rb
63
- - lib/code/parser/name.rb
64
- - lib/code/parser/negation.rb
65
- - lib/code/parser/not_keyword.rb
66
- - lib/code/parser/nothing.rb
67
- - lib/code/parser/number.rb
68
- - lib/code/parser/operation.rb
69
- - lib/code/parser/or_keyword.rb
70
- - lib/code/parser/or_operator.rb
71
- - lib/code/parser/power.rb
72
- - lib/code/parser/range.rb
73
- - lib/code/parser/rescue.rb
74
- - lib/code/parser/shift.rb
75
- - lib/code/parser/splat.rb
76
- - lib/code/parser/statement.rb
77
- - lib/code/parser/string.rb
78
- - lib/code/parser/ternary.rb
79
- - lib/code/parser/unary_minus.rb
80
- - lib/code/parser/while.rb
81
36
  - lib/template-ruby-parser.rb
82
- - lib/template.rb
83
- - lib/template/parser.rb
84
- - spec/code/parser/addition_spec.rb
85
- - spec/code/parser/and_operator_spec.rb
86
- - spec/code/parser/bitwise_and_spec.rb
87
- - spec/code/parser/bitwise_or_spec.rb
88
- - spec/code/parser/boolean_spec.rb
89
- - spec/code/parser/call_spec.rb
90
- - spec/code/parser/chained_call_spec.rb
91
- - spec/code/parser/class_spec.rb
92
- - spec/code/parser/code_spec.rb
93
- - spec/code/parser/dictionnary_spec.rb
94
- - spec/code/parser/equal_spec.rb
95
- - spec/code/parser/equality_spec.rb
96
- - spec/code/parser/function_spec.rb
97
- - spec/code/parser/greater_than_spec.rb
98
- - spec/code/parser/group_spec.rb
99
- - spec/code/parser/if_modifier_spec.rb
100
- - spec/code/parser/if_spec.rb
101
- - spec/code/parser/list_spec.rb
102
- - spec/code/parser/multiplication_spec.rb
103
- - spec/code/parser/negation_spec.rb
104
- - spec/code/parser/not_keyword_spec.rb
105
- - spec/code/parser/nothing_spec.rb
106
- - spec/code/parser/number_spec.rb
107
- - spec/code/parser/or_keyword_spec.rb
108
- - spec/code/parser/or_operator_spec.rb
109
- - spec/code/parser/power_spec.rb
110
- - spec/code/parser/range_spec.rb
111
- - spec/code/parser/rescue_spec.rb
112
- - spec/code/parser/shift_spec.rb
113
- - spec/code/parser/string_spec.rb
114
- - spec/code/parser/ternary_spec.rb
115
- - spec/code/parser/unary_minus_spec.rb
116
- - spec/code/parser/while_spec.rb
117
- - spec/code/parser_spec.rb
118
- - spec/spec_helper.rb
119
- - spec/template/parser_spec.rb
120
37
  - template-ruby-parser.gemspec
121
38
  homepage: https://github.com/dorianmariefr/template-ruby-parser
122
39
  licenses:
@@ -141,40 +58,4 @@ rubygems_version: 3.3.7
141
58
  signing_key:
142
59
  specification_version: 4
143
60
  summary: A parser for the Code programming language
144
- test_files:
145
- - spec/code/parser/addition_spec.rb
146
- - spec/code/parser/and_operator_spec.rb
147
- - spec/code/parser/bitwise_and_spec.rb
148
- - spec/code/parser/bitwise_or_spec.rb
149
- - spec/code/parser/boolean_spec.rb
150
- - spec/code/parser/call_spec.rb
151
- - spec/code/parser/chained_call_spec.rb
152
- - spec/code/parser/class_spec.rb
153
- - spec/code/parser/code_spec.rb
154
- - spec/code/parser/dictionnary_spec.rb
155
- - spec/code/parser/equal_spec.rb
156
- - spec/code/parser/equality_spec.rb
157
- - spec/code/parser/function_spec.rb
158
- - spec/code/parser/greater_than_spec.rb
159
- - spec/code/parser/group_spec.rb
160
- - spec/code/parser/if_modifier_spec.rb
161
- - spec/code/parser/if_spec.rb
162
- - spec/code/parser/list_spec.rb
163
- - spec/code/parser/multiplication_spec.rb
164
- - spec/code/parser/negation_spec.rb
165
- - spec/code/parser/not_keyword_spec.rb
166
- - spec/code/parser/nothing_spec.rb
167
- - spec/code/parser/number_spec.rb
168
- - spec/code/parser/or_keyword_spec.rb
169
- - spec/code/parser/or_operator_spec.rb
170
- - spec/code/parser/power_spec.rb
171
- - spec/code/parser/range_spec.rb
172
- - spec/code/parser/rescue_spec.rb
173
- - spec/code/parser/shift_spec.rb
174
- - spec/code/parser/string_spec.rb
175
- - spec/code/parser/ternary_spec.rb
176
- - spec/code/parser/unary_minus_spec.rb
177
- - spec/code/parser/while_spec.rb
178
- - spec/code/parser_spec.rb
179
- - spec/spec_helper.rb
180
- - spec/template/parser_spec.rb
61
+ test_files: []
data/.overcommit.yml DELETED
@@ -1,4 +0,0 @@
1
- PreCommit:
2
- Format:
3
- enabled: true
4
- command: ["bin/format"]
data/CHANGELOG.md DELETED
@@ -1,35 +0,0 @@
1
- ### 0.1.8 - November 13, 2022
2
-
3
- - Allow numbers with exponents: `1e1`
4
-
5
- ### 0.1.7 - November 13, 2022
6
-
7
- - Fix parsing of `nothing`
8
-
9
- ### 0.1.6 - November 13, 2022
10
-
11
- - Add missing operator from equal, e.g. a += 1, a = 2
12
-
13
- ### 0.1.5 - November 13, 2022
14
-
15
- - Restrict equal to simplify
16
-
17
- ### 0.1.4 - November 13, 2022
18
-
19
- - Fix a || b
20
-
21
- ### 0.1.3 - November 13, 2022
22
-
23
- - Fix parsing &, *, **
24
-
25
- ### 0.1.2 - November 12, 2022
26
-
27
- - Fix parsing `&:even?`
28
-
29
- ### 0.1.1 - November 12, 2022
30
-
31
- - Fix `:even?` and `:update?` strings
32
-
33
- ### 0.1.0 - November 12, 2022
34
-
35
- - Initial release
data/Gemfile DELETED
@@ -1,5 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "rspec"
4
- gem "syntax_tree"
5
- gem "profile"
data/Gemfile.lock DELETED
@@ -1,32 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- diff-lcs (1.5.0)
5
- prettier_print (1.0.2)
6
- profile (0.4.0)
7
- rspec (3.12.0)
8
- rspec-core (~> 3.12.0)
9
- rspec-expectations (~> 3.12.0)
10
- rspec-mocks (~> 3.12.0)
11
- rspec-core (3.12.0)
12
- rspec-support (~> 3.12.0)
13
- rspec-expectations (3.12.0)
14
- diff-lcs (>= 1.2.0, < 2.0)
15
- rspec-support (~> 3.12.0)
16
- rspec-mocks (3.12.0)
17
- diff-lcs (>= 1.2.0, < 2.0)
18
- rspec-support (~> 3.12.0)
19
- rspec-support (3.12.0)
20
- syntax_tree (4.3.0)
21
- prettier_print (>= 1.0.2)
22
-
23
- PLATFORMS
24
- arm64-darwin-21
25
-
26
- DEPENDENCIES
27
- profile
28
- rspec
29
- syntax_tree
30
-
31
- BUNDLED WITH
32
- 2.3.22
data/bin/code-parser DELETED
@@ -1,27 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "optparse"
4
- require_relative "../lib/code-ruby-parser"
5
- require "json"
6
-
7
- options = {}
8
-
9
- OptionParser
10
- .new do |opts|
11
- opts.banner = "Usage: bin/code-parser [options]"
12
-
13
- opts.on(
14
- "-i INPUT",
15
- "--input=INPUT",
16
- "Input in the code language (String or File)"
17
- ) do |input|
18
- input = File.read(input) if File.exists?(input)
19
-
20
- options[:input] = input
21
- end
22
- end
23
- .parse!
24
-
25
- input = options.fetch(:input, "")
26
-
27
- puts JSON.pretty_generate(::Code::Parser.parse(input))
data/bin/deploy DELETED
@@ -1,16 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -e
4
-
5
- rm -f *.gem
6
- git pull
7
- git push
8
- gem build template-ruby-parser.gemspec
9
- gem build code-ruby-parser.gemspec
10
-
11
- for file in *.gem
12
- do
13
- gem push $file
14
- done
15
-
16
- rm *.gem
data/bin/format DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env fish
2
-
3
- stree write Gemfile lib/**/*.rb spec/**/*.rb bin/code-parser
data/bin/parse-docs DELETED
@@ -1,6 +0,0 @@
1
- #!/bin/bash
2
-
3
- for f in docs/*.code
4
- do
5
- bin/code-parser -i $f
6
- done
data/bin/template-parser DELETED
@@ -1,27 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "optparse"
4
- require_relative "../lib/code-ruby-parser"
5
- require "json"
6
-
7
- options = {}
8
-
9
- OptionParser
10
- .new do |opts|
11
- opts.banner = "Usage: bin/template-parser [options]"
12
-
13
- opts.on(
14
- "-i INPUT",
15
- "--input=INPUT",
16
- "Input in the code language (String or File)"
17
- ) do |input|
18
- input = File.read(input) if File.exists?(input)
19
-
20
- options[:input] = input
21
- end
22
- end
23
- .parse!
24
-
25
- input = options.fetch(:input, "")
26
-
27
- puts JSON.pretty_generate(::Template::Parser.parse(input))
data/docs/class.code DELETED
@@ -1,9 +0,0 @@
1
- class ApiClient
2
- get = (url) => {
3
- fetch(url)
4
- }
5
- end
6
-
7
- class Twitter < ApiClient
8
- self.base_url = "https://api.twitter.com"
9
- end
data/docs/meetup.code DELETED
@@ -1,14 +0,0 @@
1
- url = fetch(:url) { "https://www.meetup.com/parisrb" }
2
- response = HTTP.get(url)
3
- times = response.css(".groupHome-eventsList-upcomingEvents time")
4
- times = times.map(&:datetime).map do |time|
5
- Time.from_epoch(time.to_integer)
6
- end
7
-
8
- times.each do |time|
9
- if (1.day.from_now...(1.day.from_now + 1.hour)).include?(time)
10
- Sms.send("Event in one day {url}")
11
- elsif (2.hours.from_now...(1.hour.from_now)).include(time)
12
- Sms.send("Event in two hours {url}")
13
- end
14
- end
data/docs/precedence.code DELETED
@@ -1 +0,0 @@
1
-
@@ -1,35 +0,0 @@
1
- - Code
2
- - Statement
3
- - Class
4
- - While
5
- - If
6
- - IfModifier
7
- - OrKeyword
8
- - NotKeyword
9
- - Equal
10
- - Rescue
11
- - Ternary
12
- - Range
13
- - OrOperator
14
- - AndOperator
15
- - Equality
16
- - GreaterThan
17
- - BitwiseOr
18
- - BitwiseAnd
19
- - Shift
20
- - Addition
21
- - Multiplication
22
- - UnaryMinus
23
- - Power
24
- - Negation
25
- - Splat
26
- - Function
27
- - ChainedCall
28
- - Dictionnary
29
- - List
30
- - String
31
- - Number
32
- - Boolean
33
- - Nothing
34
- - Group
35
- - Call
data/docs/rain.code DELETED
@@ -1,23 +0,0 @@
1
- paris = { latitude: 48.8566, longitude: 2.4022 }
2
- latitude = fetch(:latitude) { paris.latitude }
3
- longitude = fetch(:longitude) { paris.longitude }
4
- duration = fetch(:duration) { 1.hour }
5
- hour = duration.from_now.hour
6
-
7
- response = HTTP.get(
8
- "https://api.open-meteo.com/v1/forecast",
9
- parameters: {
10
- latitude: latitude,
11
- longitude: longitude,
12
- hourly: :precipitation
13
- }
14
- )
15
-
16
- precipitation = response.hourly.precipitation[hour]
17
- precipitation = (precipitation * 100).to_integer
18
-
19
- if precipitation > 0
20
- Sms.send(
21
- "There will be {precipitation}% of precipitation in the next hour"
22
- )
23
- end
data/docs/slack.code DELETED
@@ -1,17 +0,0 @@
1
- Slack.send("Who is leading the syncs?", channel: "#team-template")
2
-
3
- Twitter.send("What do you want to do this week?")
4
-
5
- Discord.send("Who will be the game master this week?")
6
-
7
- Email.send(
8
- subject: "What did you do last week?",
9
- from: "dorian@thoughtbot.com",
10
- reply_to: "rob@thoughtbot.com"
11
- )
12
-
13
- Email.send(
14
- subject: "What do you want to do this week?",
15
- from: "dorian@thoughtbot.com",
16
- reply_to: "rob@thoughtbot.com"
17
- )
data/docs/stripe.code DELETED
@@ -1,7 +0,0 @@
1
- event = Stripe::Webhook.event
2
-
3
- if event.type == "payment_intent.succeeded"
4
- payment_intent = event.data.object
5
- amount = Money.format(payment_intent.amount, payment_intent.currency)
6
- Sms.send("You got paid {amount}")
7
- end
data/docs/twitter.code DELETED
@@ -1,7 +0,0 @@
1
- twitter_username = fetch(:twitter_username) { "dorianmariefr" }
2
-
3
- Twitter.search("to:{twitter_username}", type: :recent).each do |tweet|
4
- next if Storage.exists?(tweet.id)
5
- Storage.create!(tweet.id)
6
- Sms.send("New mention: {tweet.user.screen_name}: {tweet.text}")
7
- end
@@ -1,13 +0,0 @@
1
- class Code
2
- class Parser
3
- class Addition < ::Code::Parser
4
- def parse
5
- parse_subclass(
6
- ::Code::Parser::Operation,
7
- operators: [PLUS, MINUS],
8
- subclass: ::Code::Parser::Multiplication
9
- )
10
- end
11
- end
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- class Code
2
- class Parser
3
- class AndOperator < ::Code::Parser
4
- def parse
5
- parse_subclass(
6
- ::Code::Parser::Operation,
7
- operators: [AMPERSAND + AMPERSAND],
8
- subclass: ::Code::Parser::Equality
9
- )
10
- end
11
- end
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- class Code
2
- class Parser
3
- class BitwiseAnd < ::Code::Parser
4
- def parse
5
- parse_subclass(
6
- ::Code::Parser::Operation,
7
- operators: [AMPERSAND],
8
- subclass: ::Code::Parser::Shift
9
- )
10
- end
11
- end
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- class Code
2
- class Parser
3
- class BitwiseOr < ::Code::Parser
4
- def parse
5
- parse_subclass(
6
- ::Code::Parser::Operation,
7
- operators: [PIPE, CARET],
8
- subclass: ::Code::Parser::BitwiseAnd
9
- )
10
- end
11
- end
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- class Code
2
- class Parser
3
- class Boolean < ::Code::Parser
4
- def parse
5
- if match(BOOLEAN_KEYWORDS)
6
- { boolean: buffer }
7
- else
8
- parse_subclass(::Code::Parser::Nothing)
9
- end
10
- end
11
- end
12
- end
13
- end