hack_cards 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1f8df8eb17a6d6b437160ef31c417a7ca2525b37
4
- data.tar.gz: 95495a444572e3d105be5f4cd873b2fa382fc801
3
+ metadata.gz: a931c27713f512445979f13cbee76e215aaaa9f1
4
+ data.tar.gz: 70a9fb09c865d365a8468b99620a12e144930518
5
5
  SHA512:
6
- metadata.gz: d8a036870f52ab3f3b45eb30602b60d92bfedc4fec48499327fc7a1aa244a91534dfb336d76cb501bf7c8d575153b9b5dcd288d085cc1d0f99c7dfd7aabdcbf9
7
- data.tar.gz: 55857ab9f10e097e9b52729d8e9809edff7bfa3928d511b1ba6fac08dc2fbbc6a57d3fa8272514b9b7a40597a149c5cb5df695ab56663778ebb64a283590452d
6
+ metadata.gz: dda06fbdc31e24e59629a50dfaa01004ab9282cb2c13e31e475caa9a28754023c312014741aee260264b9e8088ee9197359c6baf93203ab8b0efe28ac6567008
7
+ data.tar.gz: c689525689a97c4a463c99d918966a8aec0296ac8580db7c898c15da7ed97ada08a2caaea9bf6761151abe061a117df471688bfb0128f3e6ad48f3f1aa803498
@@ -1,3 +1,3 @@
1
1
  module HackCards
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hack_cards
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - MichaelByrd