iso-bib-item 0.1.0 → 0.1.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e224cd0a76535c51c7bedd5f62315320931e2f5
|
4
|
+
data.tar.gz: 6bda0b366a57d703d4a92442db1f0f3f62c7fea6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a668f88e71dcb1066d3c986a586a1f14a73c6886987c0c5d88d1e640eed5a7df54c9b12ffd181c3e7c10702679904ccb16c794ec2bc7260b3fca01e075130c3
|
7
|
+
data.tar.gz: 641178e6d888f9d4cff8626ae9f665c5f0a49c0271d5f4d8b7b9e0ae05e2c313d0bc8df8c31fde150c112a8a72129fe4bf6ae9e7db0551cdcbe93fdb6902301c
|
data/Gemfile.lock
CHANGED
data/lib/iso_bib_item.rb
CHANGED
@@ -14,19 +14,28 @@ module IsoBibItem
|
|
14
14
|
# @return [Time]
|
15
15
|
attr_reader :to
|
16
16
|
|
17
|
+
# @return [Time]
|
18
|
+
attr_reader :on
|
19
|
+
|
17
20
|
# @param type [String] "published", "accessed", "created", "activated"
|
18
21
|
# @param from [String]
|
19
22
|
# @param to [String]
|
20
|
-
def initialize(type:, from
|
23
|
+
def initialize(type:, on: nil, from: nil, to: nil)
|
24
|
+
raise ArgumentError, 'expected :on or :form argument' unless on || from
|
21
25
|
@type = type
|
22
|
-
@
|
26
|
+
@on = Time.strptime(on, '%Y-%d') if on
|
27
|
+
@from = Time.strptime(from, '%Y-%d') if from
|
23
28
|
@to = Time.strptime(to, '%Y-%d') if to
|
24
29
|
end
|
25
30
|
|
26
31
|
def to_xml(builder, **opts)
|
27
32
|
builder.date(type: type) do
|
28
|
-
|
29
|
-
|
33
|
+
if on
|
34
|
+
builder.on(opts[:no_year] ? '--' : on.year)
|
35
|
+
else
|
36
|
+
builder.from(opts[:no_year] ? '--' : from.year)
|
37
|
+
builder.to to.year if to
|
38
|
+
end
|
30
39
|
end
|
31
40
|
end
|
32
41
|
end
|
@@ -112,7 +112,7 @@ module IsoBibItem
|
|
112
112
|
@title = args[:titles].map { |t| IsoLocalizedTitle.new(t) }
|
113
113
|
@type = args[:type]
|
114
114
|
@status = IsoDocumentStatus.new(args[:docstatus])
|
115
|
-
@workgroup = IsoProjectGroup.new(args[:workgroup])
|
115
|
+
@workgroup = IsoProjectGroup.new(args[:workgroup]) if args[:workgroup]
|
116
116
|
@ics = args[:ics].map { |i| Ics.new(i) }
|
117
117
|
if args[:copyright]
|
118
118
|
@copyright = CopyrightAssociation.new(args[:copyright])
|
@@ -195,7 +195,7 @@ module IsoBibItem
|
|
195
195
|
script.each { |s| builder.script s }
|
196
196
|
abstract.each { |a| builder.abstract { a.to_xml(builder) } }
|
197
197
|
status.to_xml builder
|
198
|
-
copyright
|
198
|
+
copyright&.to_xml builder
|
199
199
|
relations.each { |r| r.to_xml builder }
|
200
200
|
if opts[:note]
|
201
201
|
builder.note("ISO DATE: #{opts[:note]}", format: 'text/plain')
|
@@ -23,7 +23,7 @@ module IsoBibItem
|
|
23
23
|
# @param title_part [String]
|
24
24
|
# @param language [String] language Iso639 code
|
25
25
|
# @param script [String] script Iso15924 code
|
26
|
-
def initialize(title_intro:, title_main:, title_part
|
26
|
+
def initialize(title_intro:, title_main:, title_part: nil, language:, script:)
|
27
27
|
@title_intro = title_intro
|
28
28
|
@title_main = title_main
|
29
29
|
@title_part = title_part
|
data/lib/iso_bib_item/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iso-bib-item
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|