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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04c826e3f638dcf675f720de0ca8ec814d1a51a3
4
- data.tar.gz: e749db72bae8985eb21026aa29768645f0c093e0
3
+ metadata.gz: a36451f4dc209ee84c55c5b408f4dd12d3689470
4
+ data.tar.gz: bfefd80b2fa35e7f8537c8f73f15c406dfd216c2
5
5
  SHA512:
6
- metadata.gz: 3772d459e9de5dc24c9c7c5693aceae7e5d53347b3609ffae2ac7282ce0e24f30d4ec78253a2383ef8bc5755d8b604622356b6816456866946b3da5a8387ff9d
7
- data.tar.gz: e18d086537adb9d955f95b46373a5d9eac76800bb3f0ee7bd639967726fbc42b65ff6af7a94d68fcb3dda22bb831b191924e868ca47c67e4cbdc817178b89302
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(name,selector)
16
- element = Element.new(name,selector,nil)
17
- define_method("_#{name}") do
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.name,parentElement.selector)
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.name().lspace < thisElement.lspace do
33
+ until parent.last.intend < thisElement.lspace do
34
34
  parent.pop
35
35
  end
36
- element = parent.last.createChild(thisElement.name,thisElement.selector)
36
+ element = parent.last.createChild(thisElement)
37
37
  rawArray.shift
38
38
  parent << element if rawArray.any? &&thisElement.lspace < nextElement.lspace
39
39
  end
@@ -1,23 +1,31 @@
1
- class Element
2
- attr_accessor :name,:parent,:selector
1
+ class PageObject
2
+ attr_accessor :name,:parent,:selector,:intend
3
3
 
4
- def createChild (name,selector)
5
- child = Element.new(name,selector,self)
6
- define_singleton_method(name) do |*arguments|
7
- $selector += selector % arguments
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,parent)
25
+ def initialize (name,selector,intend)
18
26
  @name = name
19
27
  @selector = selector
20
- @parent = parent
28
+ @intend = intend
21
29
  end
22
30
 
23
31
  end
@@ -2,14 +2,6 @@ class String
2
2
  def lspace
3
3
  self[/\A */].size
4
4
  end
5
-
6
- def name
7
- self.lstrip.split(":").first
8
- end
9
-
10
- def selector
11
- self.split(":").last
12
- end
13
5
  end
14
6
 
15
7
 
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.0
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-27 00:00:00.000000000 Z
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: removed pages and ablity to add arguments
45
+ summary: Bug Fix
46
46
  test_files: []