class Module
Public Instance Methods
inline(lang = :C, options={}) { |builder| ... }
click to toggle source
Extends the Module
class to have an inline method. The default language/builder used is C, but can be specified with the lang
parameter.
# File lib/inline.rb, line 834 def inline(lang = :C, options={}) Inline.register self case options when TrueClass, FalseClass then warn "WAR\NING: 2nd argument to inline is now a hash, changing to {:testing=>#{options}}" unless options options = { :testing => options } when Hash options[:testing] ||= false else raise ArgumentError, "BLAH" end builder_class = begin Inline.const_get(lang) rescue NameError require "inline/#{lang}" Inline.const_get(lang) end builder = builder_class.new self yield builder unless options[:testing] then unless builder.load_cache then builder.build builder.load end end end