Project

sith

0.01
No commit activity in last 3 years
No release in over 3 years
A macro preprocessor for Ruby with ruby-like template notation
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0

Runtime

~> 2.2
~> 0.2
 Project Readme

sith

sith is a macro preprocessor for Ruby

Build Status

Still a prototype.

Example:

a macro definitions file:

macro_mapper attr_reader(label)
  def ~{label}
  	@~{label}
  end
end

macro_mapper attr_writer(label)
  def ~{label}=(value)
  	@~{label} = value
  end
end

macro attr_accessor(*labels)
  attr_reader ~{labels}
  attr_writer ~{labels}
end

a ruby file

class A
  attr_accessor a, z
end
sith ruby_file.rb macro_definitions.rb > output.rb`

output.rb

class A
  def a
    @a
  end
  def z
    @z
  end
  def a=(value)
    @a = value
  end
  def z=(value)
    @z = value
  end
end

install

gem install sith

thanks

built on top of parser and unparser gems.

similar to

rubymacros

however, the macros in sith are defined using a ruby-like template notation, not a lisp-like ast notation.

built by

Alexander Ivanov