Module: Amrita2::Extention::ExpandByMember
- Extended by:
- Core::SpecOptionMeta::CompilerOption
- Defined in:
- lib/amrita2/core.rb
Overview
:nodoc:
Defined Under Namespace
Classes: Expander
Class Method Summary collapse
Instance Method Summary collapse
- #code_for_element_with_child(element, dyn_spec, cg) ⇒ Object
- #code_for_not_leaf_element(element, dyn_spec, cg, &block) ⇒ Object
- #generate_expander(spec, mod, parent = nil) ⇒ Object
Methods included from Core::SpecOptionMeta::MetaData
Class Method Details
.check_option(spec, k, v) ⇒ Object
1625 1626 |
# File 'lib/amrita2/core.rb', line 1625 def self.check_option(spec, k, v) end |
Instance Method Details
#code_for_element_with_child(element, dyn_spec, cg) ⇒ Object
1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 |
# File 'lib/amrita2/core.rb', line 1641 def code_for_element_with_child(element, dyn_spec, cg) cg.generate_static_element_code(element, dyn_spec.option) do cg.if_("block_given?") do cg.code("yield(#{dyn_spec.module_name})") cg.else_ do dyn_spec.children.each do |c| cg.code("#{dyn_spec.module_name}::#{c.sym}(val.#{c.sym})") end end end element.each_child do |e| e.amrita_compile_main_code(cg) end end end |
#code_for_not_leaf_element(element, dyn_spec, cg, &block) ⇒ Object
1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 |
# File 'lib/amrita2/core.rb', line 1628 def code_for_not_leaf_element(element, dyn_spec, cg, &block) sym = dyn_spec.name_for(element) cg.define_element_method(sym, dyn_spec.output_stream) do code_for_element_with_child(element, dyn_spec, cg, &block) end cg.define_module(dyn_spec.module_name) do cg.code("Methods = #{dyn_spec.get_methods.inspect}") cg.code("include Amrita2") cg.code("extend Amrita2") yield end end |