-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: restructure repo layout (#10)
- Loading branch information
1 parent
fa87521
commit 3f4f379
Showing
14 changed files
with
188 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: inactive-support | ||
crystal: ">= 0.36.0" | ||
version: 0.3.0 | ||
version: 0.4.0 | ||
license: MIT | ||
|
||
authors: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
require "spec" | ||
require "../../src/macro/args" | ||
require "../../src/args" | ||
|
||
def args_test(a, b, c) | ||
args | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
2 changes: 1 addition & 1 deletion
2
spec/macro/mapped_enum_spec.cr → spec/mapped_enum/mapped_enum_spec.cr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
spec/core_ext/presence_spec.cr → spec/presence/presence_spec.cr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
require "json" | ||
require "yaml" | ||
require "http" | ||
require "uri" | ||
require "./collection" | ||
|
||
module Indexable(T) | ||
include Collection(Int32, T) | ||
|
||
def each_pair(&block) : Nil | ||
each_with_index { |e, i| yield({i, e}) } | ||
end | ||
|
||
def each_pair : Iterator({Int32, T}) | ||
each.with_index.map { |(e, i)| {i, e} } | ||
end | ||
end | ||
|
||
struct NamedTuple(T) | ||
# FIXME: the co-domain should be a `Union(T.values)`, however this is not | ||
# expressable with the current compiler. | ||
# See: https://github.com/crystal-lang/crystal/issues/6757 | ||
include Collection(Symbol, NoReturn) | ||
|
||
def each_pair(&block) : Nil | ||
each { |k, v| yield({k, v}) } | ||
end | ||
|
||
def each_pair : Iterator | ||
to_a.each | ||
end | ||
end | ||
|
||
class Hash(K, V) | ||
include Collection(K, V) | ||
|
||
def each_pair(&block) : Nil | ||
each { |k, v| yield({k, v}) } | ||
end | ||
|
||
def each_pair : Iterator({K, V}) | ||
each | ||
end | ||
end | ||
|
||
struct JSON::Any | ||
include Collection(String | Int32, JSON::Any) | ||
|
||
def each_pair(&block) : Nil | ||
if value = as_h? || as_a? | ||
value.each_pair { |k, v| yield({k, v}) } | ||
end | ||
end | ||
|
||
protected def nested? : Bool | ||
!(as_h? || as_a?).nil? | ||
end | ||
end | ||
|
||
struct YAML::Any | ||
include Collection(String | Int32, YAML::Any) | ||
|
||
def each_pair(&block) : Nil | ||
if value = as_a? | ||
value.each_pair { |k, v| yield({k, v}) } | ||
elsif value = as_h? | ||
value.each_pair { |k, v| yield({k.to_s, v}) } | ||
end | ||
end | ||
|
||
protected def nested? : Bool | ||
!(as_h? || as_a?).nil? | ||
end | ||
end | ||
|
||
class HTTP::Cookies | ||
include Collection(String, HTTP::Cookie) | ||
|
||
def each_pair(&block) : Nil | ||
each { |c| yield({c.name, c}) } | ||
end | ||
|
||
def each_pair | ||
each.map { |c| ({c.name, c}) } | ||
end | ||
end | ||
|
||
struct HTTP::Headers | ||
include Collection(String, Array(String)) | ||
|
||
def each_pair(&block) : Nil | ||
each { |k, v| yield({k, v}) } | ||
end | ||
|
||
def each_pair : Iterator({String, Array(String)}) | ||
each | ||
end | ||
end | ||
|
||
struct URI::Params | ||
include Collection(String, String) | ||
|
||
def each_pair(&block) : Nil | ||
each { |k, v| yield({k, v}) } | ||
end | ||
|
||
def each_pair : Iterator({String, String}) | ||
each | ||
end | ||
end |
Oops, something went wrong.