Module: XX::Expandable::InstanceMethods
- Defined in:
- lib/xx.rb,
lib/xx-2.1.0.rb
Overview
–{{{
Instance Method Summary collapse
-
#xx_expand(template, opts = {}) ⇒ Object
–}}}.
-
#xx_expand_file(*a, &b) ⇒ Object
(also: #xx_expand_path, #xx_expand_template)
–}}}.
- #xx_expand_inline(*a, &b) ⇒ Object (also: #xx_expand_string)
-
#xx_template_file(*a, &b) ⇒ Object
–{{{.
-
#xx_template_inline(*a, &b) ⇒ Object
–}}}.
Instance Method Details
#xx_expand(template, opts = {}) ⇒ Object
–}}}
773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 |
# File 'lib/xx.rb', line 773 def 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
–}}}
795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 |
# File 'lib/xx.rb', line 795 def *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
819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 |
# File 'lib/xx.rb', line 819 def *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 |