Skip to content

Commit

Permalink
fixed indentation and syntax error
Browse files Browse the repository at this point in the history
  • Loading branch information
tompesman committed Jun 16, 2014
1 parent 09c6b24 commit 047e2b6
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions lib/pushr/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,25 @@ def to_json

private

def read_from_yaml_file
filename = Pushr::Daemon.config.configuration_file
configs = File.open( filename ) { |fd| YAML.load(fd) }
configs.map do |hsh|
klass = hsh['type'].split('::').reduce(Object) { |a, e| a.const_get e }
klass.new(hsh)
end
end
end

def read_from_redis
configurations = Pushr::Core.redis { |conn| conn.hgetall('pushr:configurations') }
configurations.each { |key, config| configurations[key] = instantiate(config, key) }
configurations.values
end

def self.instantiate(config, id)
hsh = ::MultiJson.load(config).merge!(id: id)
def read_from_yaml_file
filename = Pushr::Daemon.config.configuration_file
configs = File.open(filename) { |fd| YAML.load(fd) }
configs.map do |hsh|
klass = hsh['type'].split('::').reduce(Object) { |a, e| a.const_get e }
klass.new(hsh)
end
end

def read_from_redis
configurations = Pushr::Core.redis { |conn| conn.hgetall('pushr:configurations') }
configurations.each { |key, config| configurations[key] = instantiate(config, key) }
configurations.values
end

def self.instantiate(config, id)
hsh = ::MultiJson.load(config).merge!(id: id)
klass = hsh['type'].split('::').reduce(Object) { |a, e| a.const_get e }
klass.new(hsh)
end
end
end

0 comments on commit 047e2b6

Please sign in to comment.