aml 0.0.9 → 0.1.0
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 +4 -4
- data/lib/aml/compile.rb +3 -2
- data/lib/aml/core/method.rb +10 -5
- data/lib/aml/line_type.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d46123901065fe56b8a4c50b0f238a15ca7e59ff
|
4
|
+
data.tar.gz: 4a9a0cf2415bc9e6685aef3d7715c284b5051859
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c59f3a70af0b23062c3c5be6ece1d05661a330b64661a5decf137021f583d3ffaf66e25297f9626eb333d8dc1100a535819a58f7a30dbefb66e4413ea8b7a64
|
7
|
+
data.tar.gz: 1b90d8a2e4dd82266714ff9d526cdf67d7f2ae764d41d9a6e3058c9fe3f44e783512b365b7b275fef0ca779b7b924d0b7506f6e6e03ab81e25b87512b68d4fea
|
data/lib/aml/compile.rb
CHANGED
@@ -28,11 +28,12 @@ class Compile
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def prepare_method_structure(lines,definition)
|
31
|
-
#Placeholder
|
32
31
|
lines.each_with_index do |line,index|
|
33
32
|
if line[:type] == :method
|
34
33
|
line[:type] = :string
|
35
|
-
|
34
|
+
bundle = line[:bundle]
|
35
|
+
bundle = "Core" if bundle == 'core'
|
36
|
+
line[:value] = AbstractMarkupLanguage::Base.const_get(bundle).method(line[:name]).call(line[:index],line[:attributes])
|
36
37
|
end
|
37
38
|
end
|
38
39
|
lines
|
data/lib/aml/core/method.rb
CHANGED
@@ -1,19 +1,24 @@
|
|
1
1
|
class Core
|
2
|
+
|
2
3
|
def self.loop(index=0, a={})
|
3
4
|
return "loop"
|
4
5
|
end
|
5
|
-
|
6
|
+
|
7
|
+
def self.date(index=0, a={}, d={:format=>'%Y-%m-%d %H:%M:%S'})
|
8
|
+
a = d.merge(a)
|
6
9
|
time = Time.new
|
7
10
|
return time.strftime(a[:format])
|
8
11
|
end
|
12
|
+
|
13
|
+
def self.year(index=0, a={})
|
14
|
+
return self.date(index,{:format=>'%Y'})
|
15
|
+
end
|
16
|
+
|
9
17
|
def self.ipsum(index=0, a={})
|
10
18
|
return "%p lorem ipsum sit amet dolor"
|
11
19
|
end
|
20
|
+
|
12
21
|
def self.random(index=0, a={})
|
13
22
|
return "random"
|
14
23
|
end
|
15
|
-
def self.copyright(index=0, a={})
|
16
|
-
time = Time.new
|
17
|
-
return "%p © #{time.year}"
|
18
|
-
end
|
19
24
|
end
|
data/lib/aml/line_type.rb
CHANGED
@@ -37,15 +37,15 @@ LineType = Struct.new(:regex) do
|
|
37
37
|
end
|
38
38
|
def stringHashToHash(string)
|
39
39
|
hash = {}
|
40
|
-
regex = /:(?<name>\w+)\s?=>\s?(?<hash>{(.+?)?}|(?<quote>'|")(?<value>.+?)
|
40
|
+
regex = /:(?<name>\w+)\s?=>\s?(?<hash>{(.+?)?}|(?<quote>'|")(?<value>.+?)??\k<quote>)/
|
41
41
|
names = regex.names
|
42
42
|
if string != nil
|
43
43
|
string.scan(regex){|match|
|
44
44
|
thisHash = Hash[names.zip(match)]
|
45
|
-
if thisHash["
|
46
|
-
hash[thisHash["name"].to_sym] = thisHash["value"].to_s
|
47
|
-
else
|
45
|
+
if thisHash["hash"].to_s[0] == "{"
|
48
46
|
hash[thisHash["name"].to_sym] = stringHashToHash(thisHash["hash"])
|
47
|
+
else
|
48
|
+
hash[thisHash["name"].to_sym] = thisHash["value"].to_s
|
49
49
|
end
|
50
50
|
}
|
51
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Esquivias
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Abstract Markup Language is a robust and feature rich markup language
|
14
14
|
designed to avoid repetition and promote clear, well-indented markup.
|