iso-bib-item 0.1.0 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 43345dd1988738e08a77bc1fbd3e794ee25ec341
4
- data.tar.gz: e8dcfdb32b17d39821c37aaa49ec4a2ff23557a8
3
+ metadata.gz: 3e224cd0a76535c51c7bedd5f62315320931e2f5
4
+ data.tar.gz: 6bda0b366a57d703d4a92442db1f0f3f62c7fea6
5
5
  SHA512:
6
- metadata.gz: 98f60fea9b8cd84c7c8aa4ed133bebddd3b140a1ea29465498351166e258c4e794df056c136de74f1c9b5eab0c30f3d2d849d9d4a43347086cb2cc63507410ed
7
- data.tar.gz: 2daf622569fbed7f20ba4da92ae4c14a53156247f7ab44b1ca7733e49605c82165d7cd96916859d34394cadc49473f6666cbedae5a5bd4f5978d9f214ce84330
6
+ metadata.gz: 7a668f88e71dcb1066d3c986a586a1f14a73c6886987c0c5d88d1e640eed5a7df54c9b12ffd181c3e7c10702679904ccb16c794ec2bc7260b3fca01e075130c3
7
+ data.tar.gz: 641178e6d888f9d4cff8626ae9f665c5f0a49c0271d5f4d8b7b9e0ae05e2c313d0bc8df8c31fde150c112a8a72129fe4bf6ae9e7db0551cdcbe93fdb6902301c
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- iso-bib-item (0.1.0)
4
+ iso-bib-item (0.1.1)
5
5
  isoics
6
6
  nokogiri
7
7
 
@@ -4,6 +4,6 @@ require 'iso_bib_item/version'
4
4
  require 'iso_bib_item/iso_bibliographic_item'
5
5
 
6
6
  # ISO bibliographic model.
7
- module IsoBibItem
8
- # Your code goes here...
9
- end
7
+ # module IsoBibItem
8
+ # # Your code goes here...
9
+ # end
@@ -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:, to: nil)
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
- @from = Time.strptime(from, '%Y-%d')
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
- builder.from(opts[:no_year] ? '--' : from.year)
29
- builder.to to.year if to
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.to_xml builder
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:, language:, script:)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module IsoBibItem
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'.freeze
5
5
  end
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.0
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-10 00:00:00.000000000 Z
11
+ date: 2018-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler