Class: Slaw::ByLaw

Inherits:
Act show all
Defined in:
lib/slaw/bylaw.rb

Overview

An extension of Act which wraps an AkomaNtoso XML document describing an By-Law.

There are minor differences between Acts and By-laws, the most notable being that a by-law is not identified by a year and a number, and therefore has a different FRBR uri structure.

Constant Summary

Constants included from Namespace

Namespace::NS

Instance Attribute Summary collapse

Attributes inherited from Act

#body, #doc, #filename, #id_uri, #meta, #mtime, #nature, #schema, #year

Attributes inherited from AknBase

#doc

Instance Method Summary collapse

Methods inherited from Act

#amended?, #amended_by!, #amendment_events, #chapters, #chapters?, #date, #date=, #definitions, for_node, #initialize, #inspect, #load, #manifestation_date, #parts, #parts?, #publication, #published!, #repeal, #repealed?, #repealed_by, #repealed_on, #schedules, #sections, #term_definitions, #title=, #validate, #validates?

Methods inherited from AknBase

#parse, #to_xml

Constructor Details

This class inherits a constructor from Slaw::Act

Instance Attribute Details

#nameObject

String

A short file-like name of this by-law, unique within its year and region



14
15
16
# File 'lib/slaw/bylaw.rb', line 14

def name
  @name
end

#regionObject

String

The code of the region this by-law applies to



11
12
13
# File 'lib/slaw/bylaw.rb', line 11

def region
  @region
end

Instance Method Details

#numObject

ByLaws don’t have numbers, use their short-name instead



17
18
19
# File 'lib/slaw/bylaw.rb', line 17

def num
  name
end

#titleObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/slaw/bylaw.rb', line 21

def title
  node = @meta.at_xpath('./a:identification/a:FRBRWork/a:FRBRalias', a: NS)
  title = node ? node['value'] : "(Unknown)"

  if amended? and not title.end_with?("as amended")
    title = title + " as amended"
  end

  title
end