Skip to content

Instantly share code, notes, and snippets.

@kirushik
Created June 8, 2010 06:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kirushik/429678 to your computer and use it in GitHub Desktop.
Save kirushik/429678 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby -w
require "rubygems"
require "stringex"
module Asciiable
def method_missing(method, *args)
return self.send(Regexp.last_match(1)).to_s.to_ascii if(method.to_s=~/(.+)_ascii/)
super
end
end
class MD
include Asciiable
def get
"Робототехника"
end
def q
nil
end
end
begin
md = MD.new
puts md.get
puts md.get_ascii
puts md.send(:q_ascii)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment