metacrunch-mab2 1.2.1 → 1.3.0

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: 1f3f60e61efdc2d800bb156ef2af37b56f005d97
4
- data.tar.gz: d08b0a6f38b526dbbc29c301c84461b30e7e41f7
3
+ metadata.gz: 4fcb5d4bd47931fef5a39adc312f460f39e2b66b
4
+ data.tar.gz: 03cc9ab6343d93a805f4863e590436f5698de5d6
5
5
  SHA512:
6
- metadata.gz: 8e727ba7003c508232814161f26ffad6b5a496d20376a82bb35e7bc30256535730a6b2e9a74a09e833565654dcb76950d04a76cf9234743be386fbae19dcac5d
7
- data.tar.gz: 9cd3dfaf0acf24f3a9c581380a07477c7280df0e964e17c9bd7ec53db0b8d3e0db67cee4ca7eed12de2088417056aeb11d7ec22cb510c064c0bc8a0f406787b4
6
+ metadata.gz: a442e7314ef015a6efb7f41c1eaec8cc60fd79449c5404916a95b87d5ca2932e7082bc8ace503f56b65c0d12cb07c619369c703b1a1546ddc00a7eb1ec623090
7
+ data.tar.gz: 71ee09c43f5f725ffe6da22c34e82998fa1781037ee53c2abed1756b4c3a9a1c2b0b08ac309c7c4985e05e6ac23c739aea1ef50966a1cee7568f29a41bea630a
data/Readme.md CHANGED
@@ -1,6 +1,69 @@
1
- # metacrunch-mab2
1
+ metacrunch-mab2
2
+ ===============
2
3
 
3
4
  [![Code Climate](https://codeclimate.com/github/ubpb/metacrunch-mab2/badges/gpa.svg)](https://codeclimate.com/github/ubpb/metacrunch-mab2)
4
5
  [![Build Status](https://travis-ci.org/ubpb/metacrunch-mab2.svg)](https://travis-ci.org/ubpb/metacrunch-mab2)
5
6
 
6
- Dokumentation folgt in Kürze...
7
+ This is the official MAB2 package for the [metacrunch ETL toolkit](https://github.com/ubpb/metacrunch). It allows you to parse [MAB](https://de.wikipedia.org/wiki/Maschinelles_Austauschformat_f%C3%BCr_Bibliotheken) data and gives you access to the data by a simple and powerful API.
8
+
9
+ *Note: There is no runtime dependency to metacrunch, so it's fine to use this gem in any Ruby application where you need to read or manipulate MAB data.*
10
+
11
+
12
+ Installation
13
+ ------------
14
+
15
+ ```
16
+ $ gem install metacrunch-mab2
17
+ ```
18
+
19
+
20
+ Usage example
21
+ -------------
22
+
23
+ For the full API look at the files in [https://github.com/ubpb/metacrunch-mab2/tree/master/lib/metacrunch/mab2](https://github.com/ubpb/metacrunch-mab2/tree/master/lib/metacrunch/mab2)
24
+
25
+ **Loading the library**
26
+ ```ruby
27
+ require "metacrunch/mab2"
28
+ ```
29
+
30
+ **Parsing a [MAB XML file](https://github.com/ubpb/metacrunch-mab2/blob/master/spec/assets/aleph_mab_xml/file1.xml)**
31
+ ```ruby
32
+ document = Metacrunch::Mab2::Document.from_mab_xml(File.read("my/mab.xml"))
33
+ ```
34
+
35
+ **Accessing control fields**
36
+ ```ruby
37
+ document.controlfield("LDR")
38
+
39
+ # <Metacrunch::Mab2::Document::Controlfield:0x007f98061b4b08
40
+ # @tag="LDR",
41
+ # @values=["-", "-", "-", "-", "-", "-", "M", "2", ".", "0", "1", "2", "0", "0", "0", "2", "4", "-", "-", "-", "-", "-", "-", "h"]>
42
+ ```
43
+
44
+ **Accessing data fields**
45
+ ```ruby
46
+ document.datafields("100")
47
+
48
+ #<Metacrunch::Mab2::Document::DatafieldSet:0x007f98052e5af0
49
+ # @datafields=
50
+ # [#<Metacrunch::Mab2::Document::Datafield:0x007f98061a5ea0
51
+ # @ind1="-",
52
+ # @ind2="1",
53
+ # @subfields=
54
+ # {"p"=>[#<Metacrunch::Mab2::Document::Subfield:0x007f98061a5dd8 @code="p", @value="Kofler, Michael">],
55
+ # "d"=>[#<Metacrunch::Mab2::Document::Subfield:0x007f98061a5ce8 @code="d", @value="1967-">],
56
+ # "9"=>[#<Metacrunch::Mab2::Document::Subfield:0x007f98061a5bf8 @code="9", @value="(DE-588)121636763">]},
57
+ # @tag="100">]>
58
+ ```
59
+
60
+ ```ruby
61
+ document.datafields("100", ind1: :blank).subfields("p").value
62
+
63
+ # Kofler, Michael
64
+ ```
65
+
66
+ License
67
+ -------
68
+
69
+ metacrunch-mab2 is available at [github](https://github.com/ubpb/metacrunch-mab2) under [MIT license](https://github.com/ubpb/metacrunch-mab2/blob/master/License.txt).
data/bin/console CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  require "bundler/setup"
3
- require "metacrunch"
3
+ require "metacrunch/mab2"
4
4
 
5
5
  begin
6
6
  require "pry"
@@ -21,10 +21,17 @@ module Metacrunch
21
21
  # @param [String] xml repesenting a MAB document in Aleph MAB XML format
22
22
  # @return [Metacrunch::Mab2::Document]
23
23
  #
24
- def self.from_aleph_mab_xml(xml)
24
+ def self.from_mab_xml(xml)
25
25
  MabXmlParser.new.parse(xml)
26
26
  end
27
27
 
28
+ # TODO: Remove form 2.0
29
+ def self.from_aleph_mab_xml(xml)
30
+ d = ActiveSupport::Deprecation.new("2.0", "metacrunch-mab2")
31
+ d.deprecation_warning("#from_aleph_mab_xml", "use #from_mab_xml instead")
32
+ self.from_mab_xml(xml)
33
+ end
34
+
28
35
  def initialize
29
36
  @controlfields = {}
30
37
  @datafields = {}
@@ -1,5 +1,5 @@
1
1
  module Metacrunch
2
2
  module Mab2
3
- VERSION = "1.2.1"
3
+ VERSION = "1.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metacrunch-mab2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - René Sprotte
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2016-04-25 00:00:00.000000000 Z
13
+ date: 2016-07-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport