sharrando 0.2 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 59bb4294248e749db93c9d411e5238a3b82e24e3
4
- data.tar.gz: 74053bff63a5d71420a8626b8477172017797a04
3
+ metadata.gz: fdfc577976ba08c17f1ed9578520c4db18d802d2
4
+ data.tar.gz: 0c41e0e1e83d282f0162edef79147a4e90951668
5
5
  SHA512:
6
- metadata.gz: 512d01b929a2b6967e7ee2017a9035374195156414a5b3fc57a8ad49c29e0ef07c4b1205322db597f58ffd742ae36e72111ac743b99c5581f9dc3ec47136392c
7
- data.tar.gz: 33a8d5e1b191f0b4673b17ed21c06a7b911a7a0946cdd054c81ba6adbca4127a4d6432b9efc5afe84c884f79b9585d61034e9dcd201c2d9a0b1fc4d0253bf42f
6
+ metadata.gz: 9d19efd4899522063994c3b227a273f297593718887586b0e9f21c5d8d13140479678b522e6371a45071d17f537dd35e9e03ea17cb018eb6cf8c68ae979a6554
7
+ data.tar.gz: fe01eca3a65e5eb015e1669f7febc2603fff4217f37dc618df794270324027f4f54ac99cd1ebde2ebd0ccd4f0c9f54a1b245071d7200335c01270745d0cc8aec
@@ -9,8 +9,14 @@
9
9
  #++
10
10
 
11
11
  module Sharrando
12
- def sharrando_social_url(social, *things)
12
+ def sharrando_on(social, *things)
13
13
  things.each { |k, v| things[k] = CGI::escape(v) if v.is_a?(String) }
14
14
  Social.new.send(social, *things)
15
15
  end
16
+
17
+ Social.list.each do |social|
18
+ define_method(:"sharrando_on_#{social}") do |*things|
19
+ sharrando_on(social, *things)
20
+ end
21
+ end
16
22
  end
@@ -45,5 +45,11 @@ module Sharrando
45
45
  def linkedin(url: url, title: title, description: description, source: source)
46
46
  "http://www.linkedin.com/shareArticle?mini=true&url=#{url}&title=#{title}&summary=#{description}&source=#{source}"
47
47
  end
48
+
49
+ class << self
50
+ def list
51
+ %i(email twitter facebook google_plus tumblr delicious linkedin)
52
+ end
53
+ end
48
54
  end
49
55
  end
@@ -9,5 +9,5 @@
9
9
  #++
10
10
 
11
11
  module Sharrando
12
- VERSION = '0.2'
12
+ VERSION = '0.3'
13
13
  end
@@ -3,8 +3,13 @@ require 'sharrando'
3
3
  include Sharrando
4
4
 
5
5
  describe Sharrando do
6
- it 'gets twitter sharring url' do
7
- url = sharrando_social_url(:twitter, text: 'lololol')
6
+ it 'gets twitter sharing url' do
7
+ url = sharrando_on(:twitter, text: 'lololol')
8
+ expect(url).to be_eql('https://twitter.com/home?status=lololol')
9
+ end
10
+
11
+ it 'gets twitter sharing url via custom helper' do
12
+ url = sharrando_on_twitter(text: 'lololol')
8
13
  expect(url).to be_eql('https://twitter.com/home?status=lololol')
9
14
  end
10
15
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sharrando
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: '0.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giovanni Capuano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-13 00:00:00.000000000 Z
11
+ date: 2014-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec