myfonts 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile.lock +2 -2
- data/lib/myfonts/foundry.rb +2 -29
- data/lib/myfonts/version.rb +1 -1
- metadata +1 -1
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/lib/myfonts/foundry.rb
CHANGED
@@ -1,33 +1,6 @@
|
|
1
|
-
require "myfonts/
|
1
|
+
require "myfonts/designer"
|
2
2
|
|
3
3
|
module MyFonts
|
4
|
-
class Foundry <
|
5
|
-
def initialize(url, name=nil)
|
6
|
-
@name = name
|
7
|
-
super(url)
|
8
|
-
end
|
9
|
-
|
10
|
-
def name
|
11
|
-
@name ||= get_name
|
12
|
-
end
|
13
|
-
|
14
|
-
def families
|
15
|
-
@families ||= get_families
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def get_name
|
21
|
-
dom.css("title").text.gsub(/ . MyFonts/, "")
|
22
|
-
end
|
23
|
-
|
24
|
-
def get_families
|
25
|
-
result = dom.css("h4 a").select do |a|
|
26
|
-
a.get_attribute("href") =~ /^\/fonts/
|
27
|
-
end
|
28
|
-
result.map do |a|
|
29
|
-
Family.new("http://www.myfonts.com" + a.get_attribute("href"), a.text)
|
30
|
-
end
|
31
|
-
end
|
4
|
+
class Foundry < Designer
|
32
5
|
end
|
33
6
|
end
|
data/lib/myfonts/version.rb
CHANGED