scrap-css 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/scrap_css.rb +10 -5
  3. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 490448cf3a3a3fa6aacc3ea311fce308ad0dc378
4
- data.tar.gz: 30deea3c9ebe38f11d58a41f16e666644fa7a6bb
3
+ metadata.gz: f4e49b7bb08f4c8f2d4d381aa678b03acaf5e676
4
+ data.tar.gz: 008575496f5752b157e5ba7c136ea134420f3f45
5
5
  SHA512:
6
- metadata.gz: 626eceb7404d65cf374c1109a5bac423a9c13102c75d4ebdb3a80cad3333e8ccd0e7e9409dd9dd172f3b6f1e28246875db36594a56418145f820dd37d829704c
7
- data.tar.gz: c59fea0dca07d885d6ba7b49a17afa2ef2ca39ea7e2bd926d6b6e60e4a89447ad135e5a4606547e144ff13ac29c0ff97e594b34749e07b8b6fe47feb9a5d237b
6
+ metadata.gz: beca8e68c76ff26310a72e5465f37151dc839bba42c58fd2c25163b5946bb4742d2802c00d829af8fe17bdb8f51b03cd3ccf54461a5e5bc657371a4447ed4b7f
7
+ data.tar.gz: 970bd99cef162068452290eb545ca24f4f5efb8bc1c3443d0b01fb5f057d8a3a11a62753aaa0b21e157085693da32ac999047b92fc06e727fdd895c2418680c9
@@ -19,14 +19,19 @@ end
19
19
  class ScrapCss::Html
20
20
  def initialize(path="")
21
21
  @file_lines ||= IO.readlines(path)
22
+ @css_clases = []
23
+ end
24
+
25
+ def self.get_css_clases(str)
26
+ str.scan(/class="([^"]*)"/).flatten.map{|css| css.split(" ") }.flatten
22
27
  end
23
28
 
24
29
  def css_clases
25
- @css_clases ||= @file_lines.select{ |line|
26
- line =~ /class=/
27
- }.map{ |line|
28
- line.scan(/class="([^"]*)"/)
29
- }.flatten.uniq
30
+ return @css_clases unless @css_clases.empty?
31
+ @file_lines.each{ |line|
32
+ @css_clases << ScrapCss::Html.get_css_clases(line) if line =~ /class=/
33
+ }
34
+ @css_clases.flatten.uniq
30
35
  end
31
36
  end
32
37
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrap-css
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Savignano
@@ -10,7 +10,8 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2016-07-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: get component html and css
13
+ description: Get only the css used in a html portion; use to understand a web components
14
+ from other web site.
14
15
  email: migue.masx@gmail.com
15
16
  executables: []
16
17
  extensions: []