rats 0.3.1 → 0.3.2

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.
@@ -123,6 +123,9 @@ Parse a location
123
123
  Print the location
124
124
 
125
125
  quarter_section.location
126
+ quarter_section.location(:padded)
127
+ quarter_section.location(:short)
128
+ quarter_section.location(:long)
126
129
 
127
130
  Read the attributes
128
131
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
@@ -46,6 +46,8 @@ module Rats
46
46
  case format
47
47
  when :short
48
48
  short_location
49
+ when :padded
50
+ padded_location
49
51
  when :long
50
52
  long_location
51
53
  else
@@ -270,6 +272,14 @@ module Rats
270
272
  [@meridian.to_p,@range.to_p,@township.to_p,@section.to_p,@quarter.to_p].compact.join('').strip
271
273
  end
272
274
 
275
+ def padded_location
276
+ if self.quarter
277
+ "#{@quarter.to_p} #{[@section.to_p,@township.to_p,@range.to_p].compact.join('-')} #{@meridian.to_s}".strip
278
+ else
279
+ "#{[@section.to_p,@township.to_p,@range.to_p].compact.join('-')} #{@meridian.to_s}".strip
280
+ end
281
+ end
282
+
273
283
  def long_location
274
284
  quarter_section = []
275
285
  quarter_section << self.q.fullname if (self.q && self.q.fullname.size > 0)
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rats}
8
- s.version = "0.3.1"
8
+ s.version = "0.3.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mark G"]
12
- s.date = %q{2010-09-10}
12
+ s.date = %q{2010-09-16}
13
13
  s.description = %q{A ruby class to help with using the Alberta Township System}
14
14
  s.email = %q{rats@attackcorp.com}
15
15
  s.extra_rdoc_files = [
@@ -342,6 +342,25 @@ describe "Rats" do
342
342
 
343
343
  end
344
344
 
345
+ describe ":padded" do
346
+
347
+ it "returns NE 01-002-03 W4" do
348
+ land = Rats.new("NE 1-2-3 W4")
349
+ land.location(:padded).should == "NE 01-002-03 W4"
350
+ end
351
+
352
+ it "returns 01-002-03 W4" do
353
+ land = Rats.new("1-2-3 W4")
354
+ land.location(:padded).should == "01-002-03 W4"
355
+ end
356
+
357
+ it "returns 002-03 W4" do
358
+ land = Rats.new("2-3 W4")
359
+ land.location(:padded).should == "002-03 W4"
360
+ end
361
+
362
+ end
363
+
345
364
  describe ":long" do
346
365
 
347
366
  it "returns the long version with Quarter" do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 1
9
- version: 0.3.1
8
+ - 2
9
+ version: 0.3.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mark G
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-09-10 00:00:00 -06:00
17
+ date: 2010-09-16 00:00:00 -06:00
18
18
  default_executable:
19
19
  dependencies: []
20
20