Skip to content

Commit

Permalink
cleanup and refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
chochkov committed Feb 16, 2012
1 parent 4de908b commit 66d72d5
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
3 changes: 1 addition & 2 deletions lib/green_midget/models/countable.rb
Expand Up @@ -2,8 +2,7 @@
module GreenMidget
class Countable
attr_accessor :key

class << self; attr_accessor :prefix end
class_attribute :prefix

def self.[](key)
new(key)
Expand Down
2 changes: 1 addition & 1 deletion lib/green_midget/models/features.rb
Expand Up @@ -8,7 +8,7 @@ def probability_for(category)
end

def feature
key.gsub(/(^#{ self.class.prefix })|(::\w+_count$)/, '')
key.gsub(/(^#{self.class.prefix})|(::\w+_count$)/, '')
end
end
end
2 changes: 1 addition & 1 deletion lib/green_midget/models/words.rb
Expand Up @@ -5,7 +5,7 @@ class Words < Countable

def self.record_keys(words, category = nil)
words.map do |word|
Array(category || GreenMidget::CATEGORIES).map{ |category| Words[word].record_key(category) }
Array(category || CATEGORIES).map{ |category| Words[word].record_key(category) }
end.flatten
end

Expand Down
2 changes: 1 addition & 1 deletion lib/green_midget/version.rb
@@ -1,3 +1,3 @@
module GreenMidget
VERSION = '0.0.3'
VERSION = '0.1.0'
end
7 changes: 3 additions & 4 deletions spec/spec_helper.rb
@@ -1,16 +1,15 @@
# Copyright (c) 2011, SoundCloud Ltd., Nikola Chochkov
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))

require 'rspec'
require 'green_midget'
require 'sqlite3'

conn = { :adapter => 'sqlite3', :database => ':memory:'}
conn = { :adapter => 'sqlite3', :database => ':memory:' }
ActiveRecord::Base.establish_connection(conn)

require 'green_midget/db/migrate/create_green_midget_records'
GreenMidget::CreateGreenMidgetRecords.verbose = false
GreenMidget::CreateGreenMidgetRecords.up

RSpec.configure do |config|
end

0 comments on commit 66d72d5

Please sign in to comment.