New release Crinja 0.4.0 makes use of of Crystal annotations

This release comes with some refactorings of the public API to make it easier to use. Most prominently, annotation based autogenerator for exposing object properties to the Crinja runtime were added.

require "crinja"

class User
  include Crinja::Object::Auto

  @[Crinja::Attribute]
  def name : String
    "john paul"
  end
end

Crinja.new.from_string("{{ user.name }}").
  render({"user" => User.new}) # => "john paul"

More details on the release page.

Comment driven spec builder

https://github.com/maiha/comment-spec.cr

Comment driven spec builder for Crystal:

  • This is a spec string generator.
  • This is not a kind of spec tools.
require "comment-spec"

CommentSpec.parse "1 + 2 # => 3"                   # => "( 1 + 2 ).should eq( 3 )"
CommentSpec.parse "value # => 2016-03-31 12:36:21" # => "( value ).should eq( Time.parse(\"2016-03-31 12:36:21\", \"%F %T\") )"
CommentSpec.parse "v[10] # raises IndexError"      # => "expect_raises(IndexError) { v[10] }"
CommentSpec.parse "value # => #<XXX>"              # => "( value ).class.to_s.should eq( \"XXX\" )"

Programming Crystal: Create High-Performance, Safe, Concurrent Apps

https://pragprog.com/book/crystal/programming-crystal

A book written by Ivo Balbaert and Simon St. Laurent

Crystal is for Ruby programmers who want more performance or for developers who enjoy working in a high-level scripting environment. Crystal combines native execution speed and concurrency with Ruby-like syntax, so you will feel right at home. This book, the first available on Crystal, shows you how to write applications that have the beauty and elegance of a modern language, combined with the power of types and modern concurrency tooling. Now you can write beautiful code that runs faster, scales better, and is a breeze to deploy.