Class: Module
- Inherits:
-
Object
- Object
- Module
- Defined in:
- lib/inline.rb
Overview
module Inline
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
options is a hash that allows you to pass extra data to your builder.
Instance Method Summary collapse
-
#inline(lang = :C, options = {}) {|builder| ... } ⇒ Object
Extends the Module class to have an inline method.
Instance Attribute Details
#options ⇒ Object (readonly)
options is a hash that allows you to pass extra data to your builder. The only key that is guaranteed to exist is :testing.
794 795 796 |
# File 'lib/inline.rb', line 794 def @options end |
Instance Method Details
#inline(lang = :C, options = {}) {|builder| ... } ⇒ Object
Extends the Module class to have an inline method. The default language/builder used is C, but can be specified with the lang
parameter.
801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 |
# File 'lib/inline.rb', line 801 def inline(lang = :C, ={}) Inline.register self case when TrueClass, FalseClass then warn "WAR\NING: 2nd argument to inline is now a hash, changing to {:testing=>#{}}" unless = { :testing => } when Hash [:testing] ||= false else raise ArgumentError, "BLAH" end builder_class = begin Inline.const_get(lang) rescue NameError require "inline/#{lang}" Inline.const_get(lang) end @options = builder = builder_class.new self yield builder unless [:testing] then unless builder.load_cache then builder.build builder.load end end end |