Skip to content
This repository has been archived by the owner on Sep 12, 2018. It is now read-only.

Commit

Permalink
Updated coding conventions.
Browse files Browse the repository at this point in the history
  • Loading branch information
artob committed Sep 22, 2010
1 parent 416341f commit 049c06b
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 25 deletions.
4 changes: 2 additions & 2 deletions lib/bitcache.rb
@@ -1,15 +1,15 @@
require 'digest/sha1'
require 'pathname'
require 'stringio'
require 'addressable/uri'
require 'bitcache/version'
require 'addressable/uri' # @see http://rubygems.org/gems/addressable

module Bitcache
autoload :Adapter, 'bitcache/adapter'
autoload :Encoder, 'bitcache/encoder'
autoload :Inspectable, 'bitcache/inspectable'
autoload :Repository, 'bitcache/repository'
autoload :Stream, 'bitcache/stream'
autoload :VERSION, 'bitcache/version'

##
# Returns the Bitcache identifier for `input`.
Expand Down
6 changes: 4 additions & 2 deletions lib/bitcache/adapter.rb
Expand Up @@ -2,5 +2,7 @@ module Bitcache
##
class Adapter
extend Enumerable
end
end

# TODO
end # Adapter
end # Bitcache
14 changes: 7 additions & 7 deletions lib/bitcache/encoder.rb
Expand Up @@ -52,7 +52,7 @@ def self.encode(number)
result = []
while number > 0
number, digit = number.divmod(base)
result.unshift digits[digit].chr
result.unshift(digits[digit].chr)
end
result.empty? ? digits.first.chr : result.join('')
end
Expand All @@ -70,7 +70,7 @@ def self.decode(string)
end
result
end
end
end # Base

##
# Base-16 (hexadecimal) encoder.
Expand All @@ -79,7 +79,7 @@ def self.decode(string)
# @see http://en.wikipedia.org/wiki/Hexadecimal
class Base16 < Base
DIGITS = (?0..?9).to_a + (?a..?f).to_a
end
end # Base16

##
# Base-62 encoder.
Expand All @@ -88,14 +88,14 @@ class Base16 < Base
# @see http://en.wikipedia.org/wiki/Base_62
class Base62 < Base
DIGITS = (?0..?9).to_a + (?A..?Z).to_a + (?a..?z).to_a
end
end # Base62

##
# Base-94 encoder.
#
# @see Base
class Base94 < Base
DIGITS = (33..126).to_a
end
end
end
end # Base94
end # Encoder
end # Bitcache
4 changes: 2 additions & 2 deletions lib/bitcache/inspectable.rb
Expand Up @@ -16,5 +16,5 @@ def inspect
def inspect!
warn(inspect)
end
end
end
end # Inspectable
end # Bitcache
4 changes: 2 additions & 2 deletions lib/bitcache/repository.rb
Expand Up @@ -244,5 +244,5 @@ def to_uri
def to_rdf
RDF::URI.new(url)
end
end
end
end # Repository
end # Bitcache
8 changes: 4 additions & 4 deletions lib/bitcache/spec.rb
@@ -1,4 +1,4 @@
require 'spec'
require 'spec' # @see http://rubygems.org/gems/rspec

module Bitcache
##
Expand Down Expand Up @@ -64,6 +64,6 @@ def self.define(name, &declarations)
repository.has_stream?(stream)
end
end
end # module Matchers
end # module Spec
end # module Bitcache
end # Matchers
end # Spec
end # Bitcache
6 changes: 3 additions & 3 deletions lib/bitcache/stream.rb
Expand Up @@ -97,7 +97,7 @@ def to_rdf
#
# @return [Hash{Symbol => Object}]
def to_hash
{ :id => id, :size => size, :data => data }
{:id => id, :size => size, :data => data}
end
end
end
end # Stream
end # Bitcache
9 changes: 6 additions & 3 deletions lib/bitcache/version.rb
Expand Up @@ -5,15 +5,18 @@ module VERSION
TINY = 0
EXTRA = nil

STRING = [MAJOR, MINOR, TINY].join('.')
STRING << "-#{EXTRA}" if EXTRA
STRING = [MAJOR, MINOR, TINY, EXTRA].compact.join('.')

##
# @return [String]
def self.to_s() STRING end
def self.to_s() STRING end

##
# @return [String]
def self.to_str() STRING end

##
# @return [Array(Integer, Integer, Integer)]
def self.to_a() [MAJOR, MINOR, TINY] end
end
end

0 comments on commit 049c06b

Please sign in to comment.