ltdtemplate 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.
- data/HISTORY.txt +15 -0
- data/TEMPLATE_MANUAL.html +838 -0
- data/lib/ltdtemplate/code/call.rb +46 -0
- data/lib/ltdtemplate/code/code_block.rb +30 -0
- data/lib/ltdtemplate/code/parameters.rb +40 -0
- data/lib/ltdtemplate/code/subscript.rb +81 -0
- data/lib/ltdtemplate/code/variable.rb +77 -0
- data/lib/ltdtemplate/code.rb +102 -0
- data/lib/ltdtemplate/value/array.rb +168 -0
- data/lib/ltdtemplate/value/boolean.rb +79 -0
- data/lib/ltdtemplate/value/code_block.rb +40 -0
- data/lib/ltdtemplate/value/namespace.rb +135 -0
- data/lib/ltdtemplate/value/nil.rb +27 -0
- data/lib/ltdtemplate/value/number.rb +93 -0
- data/lib/ltdtemplate/value/string.rb +121 -0
- data/lib/ltdtemplate.rb +451 -0
- data/ltdtemplate.gemspec +16 -0
- data/test/00class.rb +20 -0
- data/test/01instance.rb +30 -0
- data/test/02tpl_literal.rb +61 -0
- data/test/03tpl_singletons.rb +48 -0
- data/test/04number.rb +36 -0
- data/test/05string.rb +30 -0
- data/test/06array.rb +34 -0
- metadata +94 -0
data/test/06array.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'ltdtemplate'
|
3
|
+
|
4
|
+
class TestLtdTemplate_06 < MiniTest::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@tpl = LtdTemplate.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_imethods
|
11
|
+
ary = @tpl.factory :array
|
12
|
+
[
|
13
|
+
:clear, :get_item, :get_value, :has_item?, :named, :positional,
|
14
|
+
:scalar?, :set_from_array, :set_from_hash, :set_item, :set_value,
|
15
|
+
:to_boolean, :to_native, :to_text
|
16
|
+
].each { |method| assert_respond_to ary, method }
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_create
|
20
|
+
@tpl.parse '<<a=a.type" "a.size>>'
|
21
|
+
assert_equal 'array 0', @tpl.render
|
22
|
+
@tpl.parse '<<a=()a.type" "a.size>>'
|
23
|
+
assert_equal 'array 0', @tpl.render
|
24
|
+
@tpl.parse '<<a=(0)a.type>>'
|
25
|
+
assert_equal 'number', @tpl.render
|
26
|
+
@tpl.parse '<<a=(0..)a.type" "a.size>>'
|
27
|
+
assert_equal 'array 1', @tpl.render
|
28
|
+
@tpl.parse '<<a=(0,1)a.type" "a.size>>'
|
29
|
+
assert_equal 'array 2', @tpl.render
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
# END
|
metadata
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ltdtemplate
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Brian Katzung
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2013-07-12 00:00:00 -05:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: A template system with limitable resource usage, e.g. for administrator-editable message localization
|
22
|
+
email:
|
23
|
+
- briank@kappacs.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- lib/ltdtemplate/value/code_block.rb
|
32
|
+
- lib/ltdtemplate/value/array.rb
|
33
|
+
- lib/ltdtemplate/value/nil.rb
|
34
|
+
- lib/ltdtemplate/value/boolean.rb
|
35
|
+
- lib/ltdtemplate/value/number.rb
|
36
|
+
- lib/ltdtemplate/value/namespace.rb
|
37
|
+
- lib/ltdtemplate/value/string.rb
|
38
|
+
- lib/ltdtemplate/code.rb
|
39
|
+
- lib/ltdtemplate/code/subscript.rb
|
40
|
+
- lib/ltdtemplate/code/code_block.rb
|
41
|
+
- lib/ltdtemplate/code/call.rb
|
42
|
+
- lib/ltdtemplate/code/parameters.rb
|
43
|
+
- lib/ltdtemplate/code/variable.rb
|
44
|
+
- lib/ltdtemplate.rb
|
45
|
+
- ltdtemplate.gemspec
|
46
|
+
- HISTORY.txt
|
47
|
+
- TEMPLATE_MANUAL.html
|
48
|
+
- test/00class.rb
|
49
|
+
- test/04number.rb
|
50
|
+
- test/05string.rb
|
51
|
+
- test/06array.rb
|
52
|
+
- test/03tpl_singletons.rb
|
53
|
+
- test/01instance.rb
|
54
|
+
- test/02tpl_literal.rb
|
55
|
+
has_rdoc: true
|
56
|
+
homepage: http://rubygems.org/gems/ltdtemplate
|
57
|
+
licenses:
|
58
|
+
- MIT
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
segments:
|
70
|
+
- 0
|
71
|
+
version: "0"
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
segments:
|
78
|
+
- 0
|
79
|
+
version: "0"
|
80
|
+
requirements: []
|
81
|
+
|
82
|
+
rubyforge_project:
|
83
|
+
rubygems_version: 1.3.7
|
84
|
+
signing_key:
|
85
|
+
specification_version: 3
|
86
|
+
summary: A template system with limitable resource usage
|
87
|
+
test_files:
|
88
|
+
- test/00class.rb
|
89
|
+
- test/04number.rb
|
90
|
+
- test/05string.rb
|
91
|
+
- test/06array.rb
|
92
|
+
- test/03tpl_singletons.rb
|
93
|
+
- test/01instance.rb
|
94
|
+
- test/02tpl_literal.rb
|