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
// settings.gradle | |
rootProject.name = 'calculator' |
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
// build.gradle | |
buildscript { | |
// use specific Kotlin version | |
ext.kotlin_version = '1.2.61' | |
} | |
plugins { | |
// install Kotlin JVM gradle plugin | |
id 'org.jetbrains.kotlin.jvm' version '1.2.61' |
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
$ ./gradlew test | |
BUILD SUCCESSFUL in 2s | |
3 actionable tasks: 2 executed, 1 up-to-date |
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
$ ./gradlew test | |
> Task :test FAILED | |
com._98elements.CalculatorSpec > adds 2 to 2 FAILED | |
org.opentest4j.AssertionFailedError at CalculatorSpec.kt:11 | |
3 tests completed, 1 failed | |
FAILURE: Build failed with an exception. |
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: src/main/kotlin/com/_98elements/Calculator.kt | |
package com._98elements | |
object Calculator { | |
fun add(a: Int, b: Int) = a + b | |
fun divide(a: Int, b: Int) = a / b | |
} |
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
# app/channels/hello_channel.rb | |
class HelloChannel < ActionCable::Channel::Base | |
def say_hello(data) | |
times_to_say_hello = data.fetch("times_to_say_hello") | |
hello = "Hello, #{current_profile.name}!" | |
times_to_say_hello.times do | |
ActionCable.server.broadcast(current_profile.id, hello) | |
end | |
end |
OlderNewer