pageify 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pageify.rb +6 -6
- data/lib/pageify/element.rb +16 -8
- data/lib/pageify/string.rb +0 -8
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a36451f4dc209ee84c55c5b408f4dd12d3689470
|
4
|
+
data.tar.gz: bfefd80b2fa35e7f8537c8f73f15c406dfd216c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e43a38fbaa046964c1f8918973778afb1ec01dfd4804cf59f2ab55bde4fbb07bce0d2a99b1acf138638ed462ba78897a449c0769dce6c8d5a2709d1983b190ca
|
7
|
+
data.tar.gz: b438790d5492c4fc9dda1b99267bc7676a80b87e7e34f6b5e2809055b674b1c4a7e149cb70b7dbaff917469a1fc27589c730d198e74a23b64494eb2903deb112
|
data/lib/pageify.rb
CHANGED
@@ -12,9 +12,9 @@ module Pageify
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
def createElement(
|
16
|
-
element =
|
17
|
-
define_method(
|
15
|
+
def createElement(raw_row)
|
16
|
+
element = PageObject.create(raw_row)
|
17
|
+
define_method(element.name) do
|
18
18
|
$selector = ""
|
19
19
|
element
|
20
20
|
end
|
@@ -25,15 +25,15 @@ module Pageify
|
|
25
25
|
rawArray = IO.read(file).split("\n").map{|x| x.rstrip}
|
26
26
|
rawArray -= [""]
|
27
27
|
parentElement = rawArray.shift
|
28
|
-
page = createElement(parentElement
|
28
|
+
page = createElement(parentElement)
|
29
29
|
parent = [page]
|
30
30
|
until rawArray.empty? do
|
31
31
|
thisElement = rawArray.first
|
32
32
|
nextElement = rawArray[1]
|
33
|
-
until parent.last.
|
33
|
+
until parent.last.intend < thisElement.lspace do
|
34
34
|
parent.pop
|
35
35
|
end
|
36
|
-
element = parent.last.createChild(thisElement
|
36
|
+
element = parent.last.createChild(thisElement)
|
37
37
|
rawArray.shift
|
38
38
|
parent << element if rawArray.any? &&thisElement.lspace < nextElement.lspace
|
39
39
|
end
|
data/lib/pageify/element.rb
CHANGED
@@ -1,23 +1,31 @@
|
|
1
|
-
class
|
2
|
-
attr_accessor :name,:parent,:selector
|
1
|
+
class PageObject
|
2
|
+
attr_accessor :name,:parent,:selector,:intend
|
3
3
|
|
4
|
-
def createChild (
|
5
|
-
child =
|
6
|
-
|
7
|
-
|
4
|
+
def createChild (raw_row)
|
5
|
+
child = PageObject.create(raw_row)
|
6
|
+
child.parent = self
|
7
|
+
define_singleton_method(child.name) do |*arguments|
|
8
|
+
$selector += child.selector % arguments
|
8
9
|
child
|
9
10
|
end
|
10
11
|
return child
|
11
12
|
end
|
12
13
|
|
14
|
+
def self.create (raw_row)
|
15
|
+
name = raw_row.lstrip.split(":").first
|
16
|
+
selector = raw_row.slice(raw_row.index(':')+1..-1)
|
17
|
+
intend = raw_row.lspace
|
18
|
+
PageObject.new(name,selector,intend)
|
19
|
+
end
|
20
|
+
|
13
21
|
def p
|
14
22
|
$selector.gsub("\"","").strip
|
15
23
|
end
|
16
24
|
|
17
|
-
def initialize (name,selector,
|
25
|
+
def initialize (name,selector,intend)
|
18
26
|
@name = name
|
19
27
|
@selector = selector
|
20
|
-
@
|
28
|
+
@intend = intend
|
21
29
|
end
|
22
30
|
|
23
31
|
end
|
data/lib/pageify/string.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pageify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Deepak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Simplify page object definition for UI tests
|
14
14
|
email: anandhadeepak@gmail.com
|
@@ -42,5 +42,5 @@ rubyforge_project:
|
|
42
42
|
rubygems_version: 2.0.3
|
43
43
|
signing_key:
|
44
44
|
specification_version: 4
|
45
|
-
summary:
|
45
|
+
summary: Bug Fix
|
46
46
|
test_files: []
|