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.
- checksums.yaml +4 -4
- data/lib/scrap_css.rb +10 -5
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4e49b7bb08f4c8f2d4d381aa678b03acaf5e676
|
4
|
+
data.tar.gz: 008575496f5752b157e5ba7c136ea134420f3f45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: beca8e68c76ff26310a72e5465f37151dc839bba42c58fd2c25163b5946bb4742d2802c00d829af8fe17bdb8f51b03cd3ccf54461a5e5bc657371a4447ed4b7f
|
7
|
+
data.tar.gz: 970bd99cef162068452290eb545ca24f4f5efb8bc1c3443d0b01fb5f057d8a3a11a62753aaa0b21e157085693da32ac999047b92fc06e727fdd895c2418680c9
|
data/lib/scrap_css.rb
CHANGED
@@ -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
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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.
|
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:
|
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: []
|