Skip to content

Commit

Permalink
Replace x as T with x.as(T)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ary Borenszweig committed Aug 4, 2016
1 parent 15a24d9 commit db860ee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/lock.cr
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ module Shards
end

def self.from_yaml(str : String)
data = YAML.parse(str).raw as Hash
data = YAML.parse(str).raw.as(Hash)

case data["version"] as String
case data["version"].as(String)
when "1.0"
(data["shards"] as Hash).map do |name, config|
Dependency.new(name.to_s, config as Hash)
data["shards"].as(Hash).map do |name, config|
Dependency.new(name.to_s, config.as(Hash))
end
else
raise InvalidLock.new # unknown lock version
Expand Down
8 changes: 4 additions & 4 deletions test/manager_test.cr
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,18 @@ module Shards
if dependencies = config["dependencies"]?
yml << "dependencies:\n"

(dependencies as Hash).each do |name, hsh|
dependencies.as(Hash).each do |name, hsh|
yml << " " << name << ": " << "\n"
(hsh as Hash).each { |k, v| yml << " " << k << ": " << v.inspect << "\n" }
hsh.as(Hash).each { |k, v| yml << " " << k << ": " << v.inspect << "\n" }
end
end

if dependencies = config["development_dependencies"]?
yml << "development_dependencies:\n"

(dependencies as Hash).each do |name, hsh|
dependencies.as(Hash).each do |name, hsh|
yml << " " << name << ": " << "\n"
(hsh as Hash).each { |k, v| yml << " " << k << ": " << v.inspect << "\n" }
hsh.as(Hash).each { |k, v| yml << " " << k << ": " << v.inspect << "\n" }
end
end
end
Expand Down

0 comments on commit db860ee

Please sign in to comment.