citrus 2.5.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +6 -0
- data/lib/citrus/core_ext.rb +19 -0
- data/lib/citrus/version.rb +1 -1
- data/lib/citrus.rb +0 -20
- data/test/helper.rb +1 -1
- metadata +2 -1
data/CHANGES
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
= 3.0.0 / 2014-03-14
|
2
|
+
|
3
|
+
* Moved Object#grammar to citrus/core_ext.rb. Citrus no longer installs core
|
4
|
+
extensions by default. Use "require 'citrus/core_ext.rb'" instead of
|
5
|
+
"require 'citrus'" to keep the previous behavior.
|
6
|
+
|
1
7
|
= 2.5.0 / 2014-03-13
|
2
8
|
|
3
9
|
* Inputs may be generated from many different sources, including Pathname and
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'citrus'
|
2
|
+
class Object
|
3
|
+
# A sugar method for creating Citrus grammars from any namespace.
|
4
|
+
#
|
5
|
+
# grammar :Calc do
|
6
|
+
# end
|
7
|
+
#
|
8
|
+
# module MyModule
|
9
|
+
# grammar :Calc do
|
10
|
+
# end
|
11
|
+
# end
|
12
|
+
#
|
13
|
+
def grammar(name, &block)
|
14
|
+
namespace = respond_to?(:const_set) ? self : Object
|
15
|
+
namespace.const_set(name, Citrus::Grammar.new(&block))
|
16
|
+
rescue NameError
|
17
|
+
raise ArgumentError, "Invalid grammar name: #{name}"
|
18
|
+
end
|
19
|
+
end
|
data/lib/citrus/version.rb
CHANGED
data/lib/citrus.rb
CHANGED
@@ -1556,23 +1556,3 @@ module Citrus
|
|
1556
1556
|
end
|
1557
1557
|
end
|
1558
1558
|
end
|
1559
|
-
|
1560
|
-
class Object
|
1561
|
-
# A sugar method for creating Citrus grammars from any namespace.
|
1562
|
-
#
|
1563
|
-
# grammar :Calc do
|
1564
|
-
# end
|
1565
|
-
#
|
1566
|
-
# module MyModule
|
1567
|
-
# grammar :Calc do
|
1568
|
-
# end
|
1569
|
-
# end
|
1570
|
-
#
|
1571
|
-
def grammar(name, &block)
|
1572
|
-
warn("Object#grammar will no longer be available by default in citrus 3.0; You should require 'citrus/core_ext'.")
|
1573
|
-
namespace = respond_to?(:const_set) ? self : Object
|
1574
|
-
namespace.const_set(name, Citrus::Grammar.new(&block))
|
1575
|
-
rescue NameError
|
1576
|
-
raise ArgumentError, "Invalid grammar name: #{name}"
|
1577
|
-
end
|
1578
|
-
end
|
data/test/helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: citrus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -46,6 +46,7 @@ files:
|
|
46
46
|
- doc/links.markdown
|
47
47
|
- doc/syntax.markdown
|
48
48
|
- doc/testing.markdown
|
49
|
+
- lib/citrus/core_ext.rb
|
49
50
|
- lib/citrus/file.rb
|
50
51
|
- lib/citrus/grammars.rb
|
51
52
|
- lib/citrus/version.rb
|