Project

newk

0.0
No commit activity in last 3 years
No release in over 3 years
Remove the need for `.new` in Ruby. You should probably never use this.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.7
~> 10.0
 Project Readme

Newk

Remove the need for .new in Ruby. You should probably never use this.

Newk a class

class Animal
  def initialize(type)
    @type = type
  end
end

require 'newk'
Newk.newk Animal

Animal(:cat) # => #<Animal:0x007ff0992b3ea0 @type=:cat>

Newk everything

class Animal
  def initialize(type)
    @type = type
  end
end

require 'newk/everything'

Animal(:cat) # => #<Animal:0x007ff0992b3ea0 @type=:cat>

...even in the future

require 'newk/everything'

class Animal
  def initialize(type)
    @type = type
  end
end

Animal(:cat) # => #<Animal:0x007ff0992b3ea0 @type=:cat>

Why?!

Because I was working through the fantastic book Understanding Computation, and was making nested expressions with classes/structs:

Machine.new(
  Add.new(
    Multiply.new(Number.new(1), Number.new(2)),
    Multiply.new(Number.new(3), Number.new(4))
  )
)

I thought it would look better like:

Machine(
  Add(
    Multiply(Number(1), Number(2)),
    Multiply(Number(3), Number(4))
  )
)