Sha256: b11f399eadccbf7733ee552422b615840b51f0e35f3279c6e74f8c80cadc0e26
Contents?: true
Size: 1.36 KB
Versions: 4
Compression:
Stored size: 1.36 KB
Contents
module ScaffoldParser module Scaffolders class XSD class Parser module Handlers class AtMethod include BaseMethod include Utils def to_s f = StringIO.new f.puts "def #{method_name}" f.puts indent(method_body.lines).join f.puts "end" f.puts f.puts "def #{method_name}_attributes" f.puts " attributes_at '#{at}'" f.puts "end" f.string.strip end def method_body "at '#{at}'" end def at [source.xmlns_prefix, "#{source.name}"].compact.join(':') end def to_h_method "hash[:#{method_name}] = #{method_name} if has? '#{at}'\n"\ "hash[:#{method_name}_attributes] = #{method_name}_attributes if has? '#{at}'" end def to_builder "root << build_element('#{at}', data[:#{method_name}], data[:#{method_name}_attributes]) if data.key? :#{method_name}" end def sequence(_) Sequence.new self end def choice(_) Choice.new self end def all(_) All.new self end end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems