Sha256: fbab9c6edf3cdbea46416043ceb5b9b406e92e6cfeffe4c82b4252a523e6575b
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
require 'slaw/act' module Slaw # Wraps an AkomaNtoso XML document describing an Act classed as a By-Law class ByLaw < Act attr_accessor :region, :name def extract_id # /za/by-law/cape-town/2010/public-parks @id_uri = @meta.at_xpath('./a:identification/a:FRBRWork/a:FRBRuri', a: NS)['value'] empty, @country, type, @region, date, @name = @id_uri.split('/') # yyyy[-mm-dd] @year = date.split('-', 2)[0] end # ByLaws don't have numbers, use their short-name instead def num name end def short_title unless @short_title node = @meta.at_xpath('./a:identification/a:FRBRWork/a:FRBRalias', a: NS) if node @short_title = node['value'] else @short_title = "(Unknown)" end if amended? and not @short_title.end_with?("as amended") @short_title = @short_title + " as amended" end end @short_title end def url_path "/#{@country}/by-law/#{@region}/#{@year}/#{@name}/" end def url_file @name end def nature "by-law" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
slaw-0.1.2 | lib/slaw/bylaw.rb |