hack_cards 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hack_cards/version.rb +1 -1
- data/lib/hack_cards.rb +22 -0
- data/test/hack_cards_test.rb +4 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a931c27713f512445979f13cbee76e215aaaa9f1
|
4
|
+
data.tar.gz: 70a9fb09c865d365a8468b99620a12e144930518
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dda06fbdc31e24e59629a50dfaa01004ab9282cb2c13e31e475caa9a28754023c312014741aee260264b9e8088ee9197359c6baf93203ab8b0efe28ac6567008
|
7
|
+
data.tar.gz: c689525689a97c4a463c99d918966a8aec0296ac8580db7c898c15da7ed97ada08a2caaea9bf6761151abe061a117df471688bfb0128f3e6ad48f3f1aa803498
|
data/lib/hack_cards/version.rb
CHANGED
data/lib/hack_cards.rb
CHANGED
@@ -21,5 +21,27 @@ module HackCards
|
|
21
21
|
string = components.reduce("") {|s, c| s + "_" + c.to_s}
|
22
22
|
string[1..-1].to_sym
|
23
23
|
end
|
24
|
+
|
25
|
+
def display
|
26
|
+
if type == :text
|
27
|
+
return text_partial
|
28
|
+
elsif type == :url
|
29
|
+
return url_partial
|
30
|
+
elsif type == :text_url
|
31
|
+
return text_url_partial
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def text_partial
|
36
|
+
"<p>#{text}</p>"
|
37
|
+
end
|
38
|
+
|
39
|
+
def url_partial
|
40
|
+
# TODO url partial
|
41
|
+
end
|
42
|
+
|
43
|
+
def text_url_partial
|
44
|
+
# TODO text url partial
|
45
|
+
end
|
24
46
|
end
|
25
47
|
end
|
data/test/hack_cards_test.rb
CHANGED
@@ -1,15 +1,10 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
3
|
class HackCardsTest < Test::Unit::TestCase
|
4
|
-
def test_version
|
5
|
-
assert_equal "0.0.1", HackCards::VERSION
|
6
|
-
end
|
7
|
-
|
8
4
|
def test_new
|
9
5
|
card = HackCards::Card.new(text: "test", url: "www.hackstarter.com")
|
10
6
|
assert_equal "test", card.text
|
11
7
|
assert_equal "www.hackstarter.com", card.url
|
12
|
-
|
13
8
|
end
|
14
9
|
|
15
10
|
def test_default_value
|
@@ -46,4 +41,8 @@ class HackCardsTest < Test::Unit::TestCase
|
|
46
41
|
assert_equal [:text, :url], card.components
|
47
42
|
end
|
48
43
|
|
44
|
+
def test_display_only_text
|
45
|
+
card = HackCards::Card.new(text: "paragraph")
|
46
|
+
assert_equal "<p>paragraph</p>", card.display
|
47
|
+
end
|
49
48
|
end
|