isValidTransformation 0.0.0
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 +7 -0
- data/lib/isValidTransformation.rb +28 -0
- metadata +57 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7965bbd97b49ead42912959fbf17130c914d203b
|
4
|
+
data.tar.gz: ce0dd1f79a07876093c781684e5e8a3d29e3b814
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5ec5b4335e8b3cb1463b5ec056172cfc079645a93f8b7239f88bca6eb9cd07b44e5de0330eee60fe56b95a27d27d5dad395c2b4d3f48e74dbc2c620472d932fd
|
7
|
+
data.tar.gz: f108d342b90e9abab375c5e11f6601ec6da0ac46031317885bf827459ba182bb45e4b5b9810d68beb88a6bdabbae40c36ff8118295dee08fbba2c4177341af9d
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
module CheckValidTransformation
|
3
|
+
|
4
|
+
def self.check(transformation)
|
5
|
+
|
6
|
+
|
7
|
+
validXml = Nokogiri::XML(transformation).errors.empty?
|
8
|
+
|
9
|
+
if validXml
|
10
|
+
document = Nokogiri::XML('<?xml version="1.0"?><trades><trade><id>2</id><value>3452</value><valuedate>20181206</valuedate></trade><trade><id>6</id><value>45</value><valuedate>54654</valuedate></trade></trades>')
|
11
|
+
|
12
|
+
template = Nokogiri::XSLT(transformation)
|
13
|
+
|
14
|
+
begin
|
15
|
+
template.transform(document)
|
16
|
+
rescue StandardError => e
|
17
|
+
print e
|
18
|
+
return false
|
19
|
+
end
|
20
|
+
|
21
|
+
return true
|
22
|
+
|
23
|
+
else
|
24
|
+
return false
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: isValidTransformation
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ngoncalves
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-12-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: nokogiri
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.8'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.8'
|
27
|
+
description: returns true if a string is a valid repgen transformation.
|
28
|
+
email: x16138601@student.ncirl.ie
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- lib/isValidTransformation.rb
|
34
|
+
homepage: http://rubygems.org/gems/isValidTransformation
|
35
|
+
licenses: []
|
36
|
+
metadata: {}
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options: []
|
39
|
+
require_paths:
|
40
|
+
- lib
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
requirements: []
|
52
|
+
rubyforge_project:
|
53
|
+
rubygems_version: 2.6.8
|
54
|
+
signing_key:
|
55
|
+
specification_version: 4
|
56
|
+
summary: verifies if a string is a valid repgen Trasformation.
|
57
|
+
test_files: []
|