From de20a159544259ceee3ba2dd03393dedf6a0c8e8 Mon Sep 17 00:00:00 2001 From: Lukas Deutz Date: Thu, 17 Jun 2021 21:33:41 -0400 Subject: [PATCH] Update for Crystal 1.0.0 and release version 0.4.0 --- README.md | 1 + shard.yml | 9 ++++++++- spec/spec_helper.cr | 1 + spec/timed_buffer_sink_spec.cr | 4 ++-- src/cute/signal.cr | 8 ++++---- src/cute/version.cr | 2 +- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 7f7b839..4f8bb07 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ Add this to your application's `shard.yml`: dependencies: cute: github: Papierkorb/cute + version: ~> 0.4.0 ``` ## Usage diff --git a/shard.yml b/shard.yml index ef326f6..68261fd 100644 --- a/shard.yml +++ b/shard.yml @@ -1,10 +1,17 @@ name: cute -version: 0.3.1 +version: 0.4.0 description: | An event-centric publisher/subscribe model for objects inspired by the Qt framework. authors: - Stefan Merettig + - Lukas Deutz + +dependencies: + future: + github: crystal-community/future.cr + +crystal: ">= 0.35, < 2.0.0" license: MPL-2 diff --git a/spec/spec_helper.cr b/spec/spec_helper.cr index fd83519..2be135a 100644 --- a/spec/spec_helper.cr +++ b/spec/spec_helper.cr @@ -1,2 +1,3 @@ require "spec" require "../src/cute" +require "future" diff --git a/spec/timed_buffer_sink_spec.cr b/spec/timed_buffer_sink_spec.cr index e0c7682..90440a0 100644 --- a/spec/timed_buffer_sink_spec.cr +++ b/spec/timed_buffer_sink_spec.cr @@ -26,9 +26,9 @@ describe Cute::TimedBufferSink do subject.notify 9 subject.notify 0 - start = Time.now + start = Time.utc Fiber.yield # We're not hitting the time constraint, right? - (start - Time.now).should be < 10.milliseconds + (start - Time.utc).should be < 10.milliseconds emits.should eq [ [ 1, 2, 3 ], [ 4, 5 ], [ 6, 7 ], [ 8, 9, 0 ] ] diff --git a/src/cute/signal.cr b/src/cute/signal.cr index a124932..edfd4a9 100644 --- a/src/cute/signal.cr +++ b/src/cute/signal.cr @@ -61,14 +61,14 @@ module Cute def on(sink : Cute::Sink(U)) forall U if sink.is_a?(Cute::Sink(Nil)) - on{ sink.notify(nil.as(U)) } + on{ sink.notify(nil.as(U)).as(U) } else {% if call.args.empty? %} - on{ sink.notify(nil.as(U)) } + on{ sink.notify(nil.as(U)).as(U) } {% elsif call.args.size == 1 %} - on{|arg| sink.notify(arg.as(U))} + on{|arg| sink.notify(arg.as(U)).as(U)} {% else %} - on{|{{ call.args.map(&.var.id).splat }}| sink.notify({ {{ call.args.map(&.var.id).splat }} }.as(U))} + on{|{{ call.args.map(&.var.id).splat }}| sink.notify({ {{ call.args.map(&.var.id).splat }} }.as(U)).as(U)} {% end %} end end diff --git a/src/cute/version.cr b/src/cute/version.cr index 73fdfa3..3f99f45 100644 --- a/src/cute/version.cr +++ b/src/cute/version.cr @@ -1,3 +1,3 @@ module Cute - VERSION = "0.3.1" + VERSION = "0.4.0" end