vidalia 0.0.2 → 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/vidalia/dsl.rb +66 -0
- data/lib/vidalia.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b5a6fbc4dd3d45c4dd8d850caaa1b42869169bc
|
4
|
+
data.tar.gz: c3807062d65f7cec8c50b039d783b7e670192c56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bfe7d16f79ff5aca0468658ea9c0ef0a8c3c1b5984a98ee7c9bbc7fe6ca07c10d60e69b6b36af77fb934c2c46031b0c40911dc48c3da425313631a904858035
|
7
|
+
data.tar.gz: ef08fcee1c8d640984caaac480692925469cbca483874a01023e7cceb5550ef61a005797ba1021d44ed2c7c4f63e6802010a680d8767588170056b419f976f1c
|
data/lib/vidalia/dsl.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
def interface(name, &block)
|
2
|
+
inter_def = Vidalia::InterfaceDefinition.new(name: name)
|
3
|
+
inter_def.instance_eval &block if block
|
4
|
+
|
5
|
+
# object and element will return Vidalia::Object and Vidalia::Element objects,
|
6
|
+
# respectively. Returning a Vidalia::Interface object makes sense here for
|
7
|
+
# consistency
|
8
|
+
inter_def.interface
|
9
|
+
end
|
10
|
+
|
11
|
+
module Vidalia
|
12
|
+
class Interface
|
13
|
+
attr_accessor :init_block
|
14
|
+
end
|
15
|
+
|
16
|
+
class Object
|
17
|
+
attr_accessor :init_block
|
18
|
+
end
|
19
|
+
|
20
|
+
class Element
|
21
|
+
attr_accessor :init_block
|
22
|
+
end
|
23
|
+
|
24
|
+
class InterfaceDefinition
|
25
|
+
# Set's the interface's init block
|
26
|
+
def init(&block)
|
27
|
+
@interface.init_block = block
|
28
|
+
end
|
29
|
+
|
30
|
+
def object(name, &block)
|
31
|
+
obj_def = Vidalia::ObjectDefinition.new(name: name, parent: self)
|
32
|
+
obj_def.instance_eval &block if block
|
33
|
+
obj_def.object
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class ObjectDefinition
|
38
|
+
def init(&block)
|
39
|
+
@object.init_block = block
|
40
|
+
end
|
41
|
+
|
42
|
+
def method_missing(meth_id, &block)
|
43
|
+
@object.add_method(name: meth_id.to_s, &block)
|
44
|
+
# TODO: Honestly not sure why I need this and why add_method doesn't
|
45
|
+
# take care of it
|
46
|
+
Vidalia::Object.define_method_for_object_class meth_id.to_s
|
47
|
+
end
|
48
|
+
|
49
|
+
def element(name, &block)
|
50
|
+
elem_def = Vidalia::ElementDefinition.new(name: name, parent: self)
|
51
|
+
elem_def.instance_eval &block if block
|
52
|
+
elem_def.element
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
class ElementDefinition
|
57
|
+
def init(&block)
|
58
|
+
@element.init_block = block
|
59
|
+
end
|
60
|
+
|
61
|
+
def method_missing(meth_id, &block)
|
62
|
+
method("add_#{meth_id}".to_sym).call(&block)
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
data/lib/vidalia.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vidalia
|
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
|
- Jeremy Rotter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -33,6 +33,7 @@ extra_rdoc_files: []
|
|
33
33
|
files:
|
34
34
|
- lib/vidalia.rb
|
35
35
|
- lib/vidalia/artifact.rb
|
36
|
+
- lib/vidalia/dsl.rb
|
36
37
|
- lib/vidalia/element.rb
|
37
38
|
- lib/vidalia/element_definition.rb
|
38
39
|
- lib/vidalia/interface.rb
|
@@ -59,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
60
|
version: '0'
|
60
61
|
requirements: []
|
61
62
|
rubyforge_project:
|
62
|
-
rubygems_version: 2.
|
63
|
+
rubygems_version: 2.6.11
|
63
64
|
signing_key:
|
64
65
|
specification_version: 4
|
65
66
|
summary: Vidalia
|