nilac 0.0.4.0.1 → 0.0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/nilac/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Nilac
2
- VERSION = "0.0.4.0.1"
2
+ VERSION = "0.0.4.1"
3
3
  end
@@ -0,0 +1,11 @@
1
+ Feature: This feature bring Ruby's if statement to Nila.
2
+ Scenario: Input function with if statements
3
+ Given the input file "regular_if.nila"
4
+ When the ~compiler is run
5
+ The output file must be "regular_if.js"
6
+ The output file must equal "correct_regular_if.js"
7
+
8
+ Configurations:
9
+
10
+ ~compiler => src/nilac.rb
11
+ :v $cliusage => ruby :v --compile $file
@@ -0,0 +1,11 @@
1
+ Feature: This feature bring Ruby's unless and until statements to Nila.
2
+ Scenario: Input function with unless and until statements
3
+ Given the input file "unless_until.nila"
4
+ When the ~compiler is run
5
+ The output file must be "unless_until.js"
6
+ The output file must equal "correct_unless_until.js"
7
+
8
+ Configurations:
9
+
10
+ ~compiler => src/nilac.rb
11
+ :v $cliusage => ruby :v --compile $file
@@ -3,12 +3,17 @@
3
3
  // This is a demo of default parameters
4
4
 
5
5
  function fill(container,liquid) {
6
- if (liquid == null) {
6
+ if (container === null) {
7
+ container = "cup";
8
+ }
9
+ if (liquid === null) {
7
10
  liquid = "coffee";
8
11
  }
9
12
  return console.log("Filling " + container + " with " + liquid);
10
13
  }
11
14
 
15
+ fill();
16
+
12
17
  fill("cup");
13
18
 
14
19
  fill("bowl","soup");
@@ -0,0 +1,14 @@
1
+ //Written using Nila. Visit http://adhithyan15.github.io/nila
2
+ (function() {
3
+ if (visitor_present) {;
4
+ //This file is for demonstration purpose. It doesn't really achieve anything
5
+ if (active || happy) {;
6
+ console.log("Hello Wonderful Visitor!");
7
+ } else if (idle && not_engaged) {;
8
+ console.log("Hello Visitor! It is time to engage!");
9
+ } else {
10
+ console.log("Hello user!");
11
+ }
12
+ }
13
+
14
+ }).call(this);
@@ -0,0 +1,21 @@
1
+ //Written using Nila. Visit http://adhithyan15.github.io/nila
2
+ (function() {
3
+ var i;
4
+
5
+ // This file demonstrates unless && until statements.
6
+
7
+ // Examples are from http://www.skorks.com/2009/09/a-wealth-of-ruby-loops-and-iterators/ &&
8
+
9
+ // http://37signals.com/svn/posts/2699-making-sense-with-rubys-unless
10
+
11
+ if (!(person.present)) {
12
+ console.log("There's no such person");
13
+ }
14
+
15
+ i = 0;
16
+
17
+ while (!(i > 10)) {
18
+ i += 1;
19
+ }
20
+
21
+ }).call(this);
@@ -1,11 +1,13 @@
1
1
  # This is a demo of default parameters
2
2
 
3
- def fill(container,liquid = "coffee")
3
+ def fill(container = "cup",liquid = "coffee")
4
4
 
5
5
  puts "Filling #{container} with #{liquid}"
6
6
 
7
7
  end
8
8
 
9
+ fill()
10
+
9
11
  fill("cup")
10
12
 
11
13
  fill("bowl","soup")
@@ -0,0 +1,19 @@
1
+ if visitor_present?
2
+
3
+ #This file is for demonstration purpose. It doesn't really achieve anything
4
+
5
+ if active? or happy?
6
+
7
+ puts "Hello Wonderful Visitor!"
8
+
9
+ elsif idle? and not_engaged?
10
+
11
+ puts "Hello Visitor! It is time to engage!"
12
+
13
+ else
14
+
15
+ puts "Hello user!"
16
+
17
+ end
18
+
19
+ end
@@ -0,0 +1,10 @@
1
+ # This file demonstrates unless and until statements.
2
+
3
+ # Examples are from http://www.skorks.com/2009/09/a-wealth-of-ruby-loops-and-iterators/ and
4
+ # http://37signals.com/svn/posts/2699-making-sense-with-rubys-unless
5
+
6
+ puts "There's no such person" unless person.present?
7
+
8
+ i = 0
9
+
10
+ i += 1 until i > 10