Skip to content

Commit 110723a

Browse files
committed
add lib to search path; require geoscript/feature
1 parent 42c9726 commit 110723a

File tree

4 files changed

+12
-17
lines changed

4 files changed

+12
-17
lines changed

Diff for: lib/geoscript.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
$:.push File.expand_path(File.join(File.dirname(__FILE__), 'geoscript'))
1+
$: << File.expand_path(File.dirname(__FILE__))
2+
$: << File.expand_path(File.join(File.dirname(__FILE__), 'geoscript'))
23

34
if defined?(JRUBY_VERSION)
45
require 'java'
@@ -13,6 +14,7 @@
1314
require 'geoscript/util'
1415
require 'geoscript/projection'
1516
require 'geoscript/geom'
17+
require 'geoscript/feature'
1618
else
1719
warn "GeoScript requires JRuby (http://jruby.org)"
1820
end

Diff for: lib/geoscript/feature.rb

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require 'feature/field'

Diff for: lib/geoscript/feature/field.rb

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module GeoScript
2+
module Feature
3+
class Field < Struct.new(:name, :type, :proj);end
4+
end
5+
end

Diff for: lib/geoscript/util/bytes.rb

+3-16
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,17 @@
33
module GeoScript
44
module Util
55
class Bytes
6-
def self.decode(str, base) # str.to_java_bytes
7-
#n = Math.log(256, base).ceil
8-
#bytes = []
9-
#(0...str.size).step(n) do |i|
10-
# bytes << string_to_byte(str[i...(i + n)].join(''), base)
11-
#end
12-
#bytes.to_java java.lang.Byte
6+
def self.decode(str, base)
137
str.to_java_bytes
148
end
159

16-
def self.encode(bytes, base) # bytes.from_java_bytes
17-
#bytes_array = []
18-
#
19-
#bytes.each do |byte|
20-
# bytes_array << byte_to_string(byte, base)
21-
#end
22-
#
23-
#bytes_array.join ''
10+
def self.encode(bytes, base)
2411
bytes.from_java_bytes
2512
end
2613

2714
def self.byte_to_string(byte, base)
2815
n = Math.log(256, base).ceil
29-
s = byte < 0 ? JInt.to_string(((b.abs ^ 0xff) + 0x01), base) : JInt.to_string(b, base)
16+
s = byte < 0 ? java.lang.Integer.to_string(((b.abs ^ 0xff) + 0x01), base) : java.lang.Integer.to_string(b, base)
3017
"%0#{n}d" % s
3118
end
3219

0 commit comments

Comments
 (0)