view_tree 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWJkOGZjYzMzODFkZTVkYzQxNDU4MzllM2UzYWQzMjVkYTQ2ZDdlYQ==
4
+ Y2IxMGUzZjBiNDE4MWQyZDdjZGQwYzBlYzg3N2M1MGI3ZTc1OGRiYw==
5
5
  data.tar.gz: !binary |-
6
- YTJhOWY0OTNjNTRhMWQzODk5ZmUxMTIwZTY3NmExYTU0ZDc4ZjI2ZA==
6
+ MzJiNzUwZjcyOGJmMjRiM2MwMDYzZDNkNGMxOTIzYWQ1MWQzNDRlMA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- OTllNDliZmQ0NjQ2MWQyOWY2NDI4MjExMDYyZjgwMDU0OWFiMmEzMmZiY2Jh
10
- NmExMGM0YzY3ZDQyNDYxY2MwN2RlM2ZjMDI1YjY2ZmQxYWY2NmYwYTRkMDVi
11
- Yzc5NGZhZWZmYzgxZTc2YzdlMjgwNjE5Njk0NmRkM2U3NGE3OTM=
9
+ NDYzOTM2MDAxNmY2Y2E4MjcxODI2OTFhM2U2MmRlMGY1MThjZTM5YWM3Zjc3
10
+ NjcyMjg1YTZhYWEwN2Y0ZTY1Njg4MDJiOTMyOGRiMzYxMWEzZmE4ZDAyYWZm
11
+ ZjIyNTNjOTAyZGFjODQ4MDVlNDI3MTNjMTNmOWEyYWFiZjE1M2Q=
12
12
  data.tar.gz: !binary |-
13
- ODU2NWM2YWYzNzc4NmViOWJmNzA4NjQxODkxMGMzMjQ0ODY3ZDQzMTZjMDE0
14
- MzZjZGJiZmE0ZDhmNjMzYTU0YzA3MmUxZmFhMmE2Njc2N2ZhODc5NGFhY2Mz
15
- YTBhZDNlODM3ZGViOTZhNGZhYjZlNTE0Nzk5NTA2NDEwNTljMzA=
13
+ YWVmM2M5ZTQxMmM5ZjI4Yzg3YjllOWNjZTk1MGRhYjVhOTc1Zjg0MjJiZDdh
14
+ NThmZGJmOTg2ODM1ZDQxY2NhMjI0MzQ5ZDFmNTljN2Y1YTdhYTkzNGZiODdl
15
+ NWVlOWZmZTNmNTkzN2UxNGJlNzgzYmJhZjJlYmY5MzAzYzQ5Yjc=
@@ -1,3 +1,3 @@
1
1
  module ViewTree
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/view_tree.rb CHANGED
@@ -31,20 +31,24 @@ class Cb
31
31
  # push all the partials into queue
32
32
 
33
33
  reg_partial_name = /(?<=(partial=>)|(render)|(spotpartial=>))\s*['"][a-zA-Z_\/-]+(?=['"])/
34
-
35
- File.readlines(file_name).each do |line|
36
- if !reg_partial_name.match(line).nil?
37
- partial_name = reg_partial_name.match(line)
38
- partial_name = partial_name.to_s.gsub!(/[\s'"]*/, "")
39
- if !partial_name[/spot_loader/].nil?
40
- partial_name = line[/(?<=spotpartial=>)\s*['"][a-zA-Z_\/-]+(?=['"])/].to_s.gsub!(/[\s'"]*/, "")
41
- else
42
- partial_name = File.basename(partial_name)
34
+
35
+ begin
36
+ File.readlines(file_name).each do |line|
37
+ if !reg_partial_name.match(line).nil?
38
+ partial_name = reg_partial_name.match(line)
39
+ partial_name = partial_name.to_s.gsub!(/[\s'"]*/, "")
40
+ if !partial_name[/spot_loader/].nil?
41
+ partial_name = line[/(?<=spotpartial=>)\s*['"][a-zA-Z_\/-]+(?=['"])/].to_s.gsub!(/[\s'"]*/, "")
42
+ else
43
+ partial_name = File.basename(partial_name)
44
+ end
45
+ self.view_helper("_" + partial_name + ".html.erb" )
43
46
  end
44
- self.view_helper("_" + partial_name + ".html.erb" )
45
47
  end
48
+ rescue
49
+ puts "Please input correct controller and action name."
50
+ exit
46
51
  end
47
-
48
52
  end
49
53
 
50
54
 
@@ -72,13 +76,7 @@ class Cb
72
76
 
73
77
  view_name = controller_action_name.gsub(/#/, "/")
74
78
 
75
- begin
76
- File.open(file_name)
77
- rescue
78
- puts "Please input correct controller and action name."
79
- exit
80
- end
81
-
79
+
82
80
 
83
81
  self.view_helper(view_name)
84
82
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: view_tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent