Skip to content

Commit

Permalink
Use namespace prefixes for attribute access. Closes #26.
Browse files Browse the repository at this point in the history
This is a breaking change in Nokogiri 1.5.6 and so makes this library
only work with Nokogiri 1.5.6 and later.

This also fixes a bunch (but not all) of the spec failures under JRuby
discussed under #5.
  • Loading branch information
rsutphin committed Dec 20, 2012
1 parent 4561caa commit e257e1b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ NCS Navigator MDES Module history
- Introduce MDES 3.2 support using specification version 3.2.00.00. (#24)
- Update MDES 3.1 to specification version 3.1.01.00. (#23)
- Expose DispositionCode attribute list.
- Adapt to backwards-incompatible change in Nokogiri-C 1.5.6. (#26)

0.10.0
------
Expand Down
8 changes: 4 additions & 4 deletions lib/ncs_navigator/mdes/variable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,20 @@ def from_element(element, options={})
var.nillable = element['nillable'] == 'true'
var.omittable = element['minOccurs'] == '0'
var.pii =
case element['pii']
case element['ncsdoc:pii']
when 'Y'; true;
when 'P'; :possible;
when nil; :unknown;
when ''; false;
else element['pii'];
else element['ncsdoc:pii'];
end
var.status =
case element['status']
case element['ncsdoc:status']
when '1'; :active;
when '2'; :new;
when '3'; :modified;
when '4'; :retired;
else element['status'];
else element['ncsdoc:status'];
end
var.type =
if element['type']
Expand Down
12 changes: 6 additions & 6 deletions lib/ncs_navigator/mdes/variable_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ def from_xsd_simple_type(st, options={})
vt.min_length = elt['value'].to_i
when 'enumeration'
(vt.code_list ||= CodeList.new) << CodeListEntry.from_xsd_enumeration(elt, options)
if elt['desc'] =~ /\S/
if elt['ncsdoc:desc'] =~ /\S/
if vt.code_list.description.nil?
vt.code_list.description = elt['desc']
elsif vt.code_list.description != elt['desc']
vt.code_list.description = elt['ncsdoc:desc']
elsif vt.code_list.description != elt['ncsdoc:desc']
log.warn("Code list entry on line #{elt.line} unexpectedly has a different desc from the first entry")
end
end
Expand Down Expand Up @@ -179,9 +179,9 @@ def from_xsd_enumeration(enum, options={})
log.warn("Missing value for code list entry on line #{enum.line}") unless enum['value']

new(enum['value'] && enum['value'].strip).tap do |cle|
cle.label = enum['label']
cle.global_value = enum['global_value']
cle.master_cl = enum['master_cl']
cle.label = enum['ncsdoc:label']
cle.global_value = enum['ncsdoc:global_value']
cle.master_cl = enum['ncsdoc:master_cl']
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion ncs_mdes.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ National Children's Study's Master Data Element Specification.
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]

s.add_dependency 'nokogiri', '~> 1.4'
s.add_dependency 'nokogiri', '~> 1.5.6'

s.add_development_dependency 'rspec', '~> 2.6.0' # Can't use 2.7.0 due to #477
s.add_development_dependency 'rake', '~> 0.9.2'
Expand Down

0 comments on commit e257e1b

Please sign in to comment.