wadling 0.1.2 → 0.1.3

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: 87574dd38bdd52124dda42d83f628a5c5baba058
4
- data.tar.gz: bba1ad54c527ca9f0569fee89e284607264d00ea
3
+ metadata.gz: c2da58b02a22f880d6f31203d7a00d8d3f9c64fd
4
+ data.tar.gz: b2fdffaa21df7501b320db5f9c07d52402ed718a
5
5
  SHA512:
6
- metadata.gz: 5daff3dd15d0889d86d7b56078abc723fd2d32aa3cfe9053f81a8f91260519bb7e4a96817caaa2d6bf59012ef62c238293598313c1da84254124fc7426adf93b
7
- data.tar.gz: c25f7b957c279e607037d20ea28b2cad98d2eb2c49848ab55aeed65b9784d1943ac7cb7e90d19542cdfe979f2fa776ae20ff52af450dc8395c31a2f2a1c8b458
6
+ metadata.gz: edbf4e9ed10b1ec8901ad799ed075385836078b59062908e434a23ee7a45eda75963ee0a1a492cd4a6ad2ceac833d731a6ad3914fd0bdb77afed1342cfcaa334
7
+ data.tar.gz: 1a7c0a68e0a9759e7e36d2e907add99e2636b467c59023390d26ff378b25a1ad0f26b182b57ca03190da026f0e1d8cb2fb62bfa7d3a548a8de3a6511fa93c484
@@ -1,3 +1,3 @@
1
1
  module Wadling
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/lib/wadling.rb CHANGED
@@ -3,6 +3,12 @@ require 'byebug'
3
3
 
4
4
  module Wadling
5
5
  class LexiconTranslator
6
+ attr_accessor :style_sheet
7
+
8
+ def initialize(style_sheet = "/public/wadl")
9
+ @style_sheet = style_sheet
10
+ end
11
+
6
12
  def translate_resources_into_wadl(resources)
7
13
  return empty_wadl if no_resources?(resources)
8
14
  raise ArgumentError.new("A resource dictionary is expected") if resources_invalid?(resources)
@@ -11,7 +17,7 @@ module Wadling
11
17
 
12
18
  def header
13
19
  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" \
14
- "<?xml-stylesheet type=\"text/xsl\" href=\"public/wadl\"?>" \
20
+ "<?xml-stylesheet type=\"text/xsl\" href=\"#{@style_sheet}\"?>" \
15
21
  "<wadl:application xmlns:wadl=\"http://wadl.dev.java.net/2009/02\"" \
16
22
  " xmlns:jr=\"http://jasperreports.sourceforge.net/xsd/jasperreport.xsd\"" \
17
23
  " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://wadl.dev.java.net/2009/02 wadl.xsd \">"
@@ -7,7 +7,7 @@ describe Wadling do
7
7
 
8
8
  before :all do
9
9
  @iut = Wadling::LexiconTranslator.new
10
- @wadl_header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><?xml-stylesheet type=\"text/xsl\" href=\"public/wadl\"?><wadl:application xmlns:wadl=\"http://wadl.dev.java.net/2009/02\" xmlns:jr=\"http://jasperreports.sourceforge.net/xsd/jasperreport.xsd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://wadl.dev.java.net/2009/02 wadl.xsd \"><wadl:resources base=\"/\">"
10
+ @wadl_header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><?xml-stylesheet type=\"text/xsl\" href=\"/public/wadl\"?><wadl:application xmlns:wadl=\"http://wadl.dev.java.net/2009/02\" xmlns:jr=\"http://jasperreports.sourceforge.net/xsd/jasperreport.xsd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://wadl.dev.java.net/2009/02 wadl.xsd \"><wadl:resources base=\"/\">"
11
11
  @wadl_footer = "</wadl:resources>" \
12
12
  "</wadl:application>"
13
13
  @empty_wadl = @wadl_header + @wadl_footer
@@ -60,6 +60,17 @@ describe Wadling do
60
60
  @wadl2 = @wadl_header + @resource1_wadl + @resource2_wadl + @wadl_footer
61
61
  end
62
62
 
63
+ context "when initialize" do
64
+ it "should default to /public/wadl for the stylesheet if none is provided" do
65
+ expect(@iut.style_sheet).to eq("/public/wadl")
66
+ end
67
+
68
+ it "should remember the stylesheet is one is provided" do
69
+ iut = Wadling::LexiconTranslator.new("/some/stylesheet")
70
+ expect(iut.style_sheet).to eq("/some/stylesheet")
71
+ end
72
+ end
73
+
63
74
  context "when given nil" do
64
75
  it "should return an empty WADL descriptor" do
65
76
  expect(@iut.translate_resources_into_wadl(nil)).to eq(@empty_wadl)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wadling
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernst van Graan