rcoins 0.0.1

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.
Files changed (6) hide show
  1. data/Manifest +4 -0
  2. data/README +3 -0
  3. data/Rakefile +12 -0
  4. data/lib/rcoins.rb +40 -0
  5. data/rcoins.gemspec +29 -0
  6. metadata +66 -0
data/Manifest ADDED
@@ -0,0 +1,4 @@
1
+ README
2
+ Rakefile
3
+ lib/rcoins.rb
4
+ Manifest
data/README ADDED
@@ -0,0 +1,3 @@
1
+ rCOinS
2
+
3
+ Create a COinS span tag in a human readable syntax.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'echoe'
4
+
5
+ Echoe.new('rcoins', '0.0.1') do |p|
6
+ p.description = "A gem allows to create a COinS - span - tag with an human readable syntax."
7
+ p.url = "http://github.com/daandi/rcoins"
8
+ p.author = "Andreas Neumann"
9
+ p.email = "info @nospam@ an-it.com"
10
+ p.ignore_pattern = ["tmp/*", "script/*"]
11
+ p.development_dependencies = []
12
+ end
data/lib/rcoins.rb ADDED
@@ -0,0 +1,40 @@
1
+ # coding: utf-8
2
+ # Author: Andreas Neumann
3
+
4
+ require 'cgi'
5
+
6
+
7
+ class COinS
8
+
9
+ def initialize(input)
10
+ @mapping = mapping
11
+ @coins_pairs = build_COinS_pairs(input)
12
+ end
13
+
14
+ def mapping
15
+ {
16
+ :journal_title => 'rft.title',
17
+ :book_title => 'rft.btitle',
18
+ :title => 'rft.atitle',
19
+ :article_title => 'rft.atitle',
20
+ :author => 'rft.aucorp',
21
+ :date => 'rft.date',
22
+ :place => 'rft.place',
23
+ :type => 'rft.genre',
24
+ :issn => 'rft.issn',
25
+ :isbn => 'rft.isbn',
26
+ :pages => 'rft.pages'
27
+ }
28
+ end
29
+
30
+ def toHTML
31
+ "<span class='Z3988' title='#{ @coins_pairs.join('&amp;') }'></span>"
32
+ end
33
+
34
+ def build_COinS_pairs(input)
35
+ input.inject([]) do |acc, inp|
36
+ key, value = inp
37
+ acc << "#{ @mapping[key] }=#{ CGI.escape( value ) }"
38
+ end
39
+ end
40
+ end
data/rcoins.gemspec ADDED
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{rcoins}
5
+ s.version = "0.0.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Andreas Neumann"]
9
+ s.date = %q{2011-04-07}
10
+ s.description = %q{A gem allows to create a COinS - span - tag with an human readable syntax.}
11
+ s.email = %q{info @nospam@ an-it.com}
12
+ s.extra_rdoc_files = ["README", "lib/rcoins.rb"]
13
+ s.files = ["README", "Rakefile", "lib/rcoins.rb", "Manifest", "rcoins.gemspec"]
14
+ s.homepage = %q{http://github.com/daandi/rcoins}
15
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Rcoins", "--main", "README"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = %q{rcoins}
18
+ s.rubygems_version = %q{1.6.0}
19
+ s.summary = %q{A gem allows to create a COinS - span - tag with an human readable syntax.}
20
+
21
+ if s.respond_to? :specification_version then
22
+ s.specification_version = 3
23
+
24
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
25
+ else
26
+ end
27
+ else
28
+ end
29
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rcoins
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Andreas Neumann
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-04-07 00:00:00 +02:00
14
+ default_executable:
15
+ dependencies: []
16
+
17
+ description: A gem allows to create a COinS - span - tag with an human readable syntax.
18
+ email: info @nospam@ an-it.com
19
+ executables: []
20
+
21
+ extensions: []
22
+
23
+ extra_rdoc_files:
24
+ - README
25
+ - lib/rcoins.rb
26
+ files:
27
+ - README
28
+ - Rakefile
29
+ - lib/rcoins.rb
30
+ - Manifest
31
+ - rcoins.gemspec
32
+ has_rdoc: true
33
+ homepage: http://github.com/daandi/rcoins
34
+ licenses: []
35
+
36
+ post_install_message:
37
+ rdoc_options:
38
+ - --line-numbers
39
+ - --inline-source
40
+ - --title
41
+ - Rcoins
42
+ - --main
43
+ - README
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: "0"
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "1.2"
58
+ requirements: []
59
+
60
+ rubyforge_project: rcoins
61
+ rubygems_version: 1.6.0
62
+ signing_key:
63
+ specification_version: 3
64
+ summary: A gem allows to create a COinS - span - tag with an human readable syntax.
65
+ test_files: []
66
+