haml2phlex 0.1.12 → 0.1.14

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
  SHA256:
3
- metadata.gz: fe7d9d2f9082b9373d008a5e65f604e8d066697586647af7ea10ee464e453e2d
4
- data.tar.gz: 70d5c75428e1aab5a97dd0f2340de9a726dcbff228443332af204e3526caf813
3
+ metadata.gz: 0f1117318b9c7c9e61fbdc8bf59af2f2bdb33f6fc6447c49e44e0abb54292571
4
+ data.tar.gz: f8981ee3e9fbb12df97fe30ad746ce8bc0f86bce88d50ccced5c8d768647fcf2
5
5
  SHA512:
6
- metadata.gz: 7dbe723f2fbd89ab7bc8022d74575cfff27063552d7a1a900bf34a483e39f223fdf0f4ade2449fcc940f0b5694f7c5325fa5f61d9c561d31cb0f53ff48e6d80a
7
- data.tar.gz: 2651bdb3d94a91869f403707770db0afd49edeaf020285ef39e4b1c16e3d1a3d1c2fc6b186ecc14e4de07ef1c484bb18d060153331a08a4c1f9041756d7b90dc
6
+ metadata.gz: f532eb8ff68ac3dbfa099e922bf2bddb9fe758ac5224aea8ea018ead70d210ee3ee629c666cf71e38fbc1846c35fc7a9ca6fcddccce40646481d53e6d2b001f9
7
+ data.tar.gz: 0d745a0e2ca1d6fdc35a8d478887530fa414942c7e6d1e4ed7df9017d9c7eedaaf0715048427097f1ebf5e4597db88f13f2c243d8dbf95ed84b923c098a04edf
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- haml2phlex (0.1.12)
4
+ haml2phlex (0.1.14)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -36,7 +36,7 @@ x = Haml2phlex::Haml2flex.new('user_customizes/_show.html.haml', spacer: "\t", b
36
36
  puts x.out
37
37
  ```
38
38
 
39
- or to output to a corresponding file (in this case app/views/user_customizes/show.rb)
39
+ or to output to a corresponding file with class definitions etc. (in this case app/views/user_customizes/show.rb)
40
40
  ```ruby
41
41
  x = Haml2phlex::Haml2flex.new('user_customizes/_show.html.haml', spacer: "\t", base_root: "app/views/")
42
42
  puts x.to_file
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Haml2phlex
3
- VERSION = '0.1.12'
3
+ VERSION = '0.1.14'
4
4
  end
5
5
  #this file gets overwritten automatically on minor updates, major ones need to be manually changed
data/lib/haml2phlex.rb CHANGED
@@ -238,26 +238,35 @@ class Haml2phlex
238
238
  rb_fname = self.base_root + rb_fname + ".rb"
239
239
 
240
240
  f = File.open(rb_fname, 'w+')
241
+
242
+ super_the_template = ((defined?(Views::ApplicationView)) and (Views::ApplicationView.instance_methods.include?(:template)))
243
+
241
244
  f.write %Q{
242
245
  module Views
243
- class #{rb_class} < Phlex::HTML
244
- include ApplicationView
246
+ class #{rb_class} < Phlex::HTML
247
+ include ApplicationView
245
248
 
246
- def initialize(**args)
247
- #sets whatever you put in as a instance variable
248
- for k in args.keys
249
- self.instance_variable_set("@\#{k}", args[k])
250
- end
251
- end
249
+ def initialize(**args)
250
+ #sets whatever you put in as a instance variable should prob delete and make optional arguments.
251
+ #it would be useful if we could automatically make every variable in the phlex output into class
252
+ #variables, then you wouldn't have to change nearly anything on conversion.
253
+ for k in args.keys
254
+ self.instance_variable_set("@\#{k}", args[k])
255
+ end
256
+ end
252
257
 
253
- def template(&)
254
- base_page(&)
255
- end
258
+ def template(&)
259
+ #{'super do' if super_the_template}
260
+ #{"\t" if super_the_template}base_page(&)
261
+ #{'end' if super_the_template}
262
+ end
256
263
 
257
- def base_page(&)
258
- #{out}
259
- end
260
- end
264
+ def base_page(&)
265
+ #_______________________________________START
266
+ #{out}
267
+ #_______________________________________END
268
+ end
269
+ end
261
270
  end}
262
271
  f.close
263
272
  puts 'written to ' + rb_fname
Binary file
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml2phlex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Clancy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-17 00:00:00.000000000 Z
11
+ date: 2023-02-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: this is a 'good enough' converter from haml view rendering to phlex view
14
14
  .
@@ -30,6 +30,8 @@ files:
30
30
  - lib/haml2phlex/version.rb
31
31
  - pkg/haml2phlex-0.1.10.gem
32
32
  - pkg/haml2phlex-0.1.11.gem
33
+ - pkg/haml2phlex-0.1.12.gem
34
+ - pkg/haml2phlex-0.1.13.gem
33
35
  - pkg/haml2phlex-0.1.4.gem
34
36
  - pkg/haml2phlex-0.1.5.gem
35
37
  - pkg/haml2phlex-0.1.6.gem