Module: XX::Expandable::InstanceMethods

Defined in:
lib/rcov/xx.rb

Overview

–{{{

Instance Method Summary collapse

Instance Method Details

#xx_expand(template, opts = {}) ⇒ Object

–}}}



804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
# File 'lib/rcov/xx.rb', line 804

def xx_expand template, opts = {}
#--{{{
  port = opts['port'] || opts[:port] || STDOUT
  pretty = opts['pretty'] || opts[:pretty]
  binding = opts['binding'] || opts[:binding]

  type = template.type

  unless type === self
    klass = self.class
    klass.module_eval{ include type }
  end

  display = pretty ? 'pretty' : 'to_str'

  Binding.of_caller do |scope|
    binding ||= eval('binding', scope)
    doc = eval template.template, binding
    doc.send display, port
  end
#--}}}
end

#xx_expand_file(*a, &b) ⇒ Object Also known as: xx_expand_path, xx_expand_template

–}}}



826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
# File 'lib/rcov/xx.rb', line 826

def xx_expand_file *a, &b
#--{{{
  template = xx_template_file *a, &b

  type = template.type
  pretty = template.pretty
  port = template.port

  unless type === self
    klass = self.class
    klass.module_eval{ include type }
  end

  display = pretty ? 'pretty' : 'to_str'

  Binding.of_caller do |scope|
    binding ||= eval('binding', scope)
    doc = eval template.template, binding
    doc.send display, port
  end
#--}}}
end

#xx_expand_inline(*a, &b) ⇒ Object Also known as: xx_expand_string



850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
# File 'lib/rcov/xx.rb', line 850

def xx_expand_inline *a, &b
#--{{{
  template = xx_template_inline *a, &b

  type = template.type
  pretty = template.pretty
  port = template.port

  unless type === self
    klass = self.class
    klass.module_eval{ include type }
  end

  display = pretty ? 'pretty' : 'to_str'

  Binding.of_caller do |scope|
    binding ||= eval('binding', scope)
    doc = eval template.template, binding
    doc.send display, port
  end
#--}}}
end

#xx_template_file(*a, &b) ⇒ Object

–{{{



790
791
792
793
794
795
796
# File 'lib/rcov/xx.rb', line 790

def xx_template_file *a, &b
#--{{{
  template = XX::Template::File.new *a, &b
  template.object ||= self
  template
#--}}}
end

#xx_template_inline(*a, &b) ⇒ Object

–}}}



797
798
799
800
801
802
803
# File 'lib/rcov/xx.rb', line 797

def xx_template_inline *a, &b
#--{{{
  template = XX::Template::Inline.new *a, &b
  template.object ||= self
  template
#--}}}
end