Skip to content

Commit

Permalink
Bump ameba and apply suggestions. Fixing up some code (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwoertink authored Sep 15, 2023
1 parent c1d3830 commit af6f7f6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ license: MIT
development_dependencies:
ameba:
github: crystal-ameba/ameba
version: ~> 1.0.0
version: ~> 1.5.0
4 changes: 2 additions & 2 deletions spec/lucky_env_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe LuckyEnv do
it "loads the ENV if the file exists" do
results = LuckyEnv.load?("./spec/support/.env.test")
results.should_not eq(nil)
data = results.not_nil!
data = results.as(Hash(String, String))
data["LUCKY_ENV"].should eq "test"
ENV["LUCKY_ENV"].should eq "test"
end
Expand Down Expand Up @@ -141,7 +141,7 @@ describe LuckyEnv do
end
end

private def restore_env(env)
private def restore_env(env, &)
yield
ensure
ENV.clear
Expand Down
6 changes: 3 additions & 3 deletions src/lucky_env.cr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module LuckyEnv
VERSION = {{ `shards version "#{__DIR__}"`.chomp.stringify }}

macro add_env(name)
def LuckyEnv.{{ name.id }}?
def LuckyEnv.{{ name.id }}? : Bool
environment == {{ name.id.stringify }}
end
end
Expand All @@ -30,11 +30,11 @@ module LuckyEnv
end
end

def self.task?
def self.task? : Bool
ENV["LUCKY_TASK"]? == "true" || ENV["LUCKY_TASK"]? == "1"
end

def self.environment
def self.environment : String
ENV.fetch("LUCKY_ENV", "development")
end

Expand Down

0 comments on commit af6f7f6

Please sign in to comment.