class ScaffoldParser::Scaffolders::XSD::Parser::Handlers::ProxyListMethod
Attributes
at[RW]
item_class[RW]
Public Class Methods
new(source) { |self| ... }
click to toggle source
# File lib/scaffold_parser/scaffolders/xsd/parser/handlers/proxy_list_method.rb, line 12 def initialize(source) @source = source yield self if block_given? end
Public Instance Methods
method_body()
click to toggle source
# File lib/scaffold_parser/scaffolders/xsd/parser/handlers/proxy_list_method.rb, line 17 def method_body "array_of_at(#{item_class}, #{single_quote(at)})" end
name_with_prefix()
click to toggle source
# File lib/scaffold_parser/scaffolders/xsd/parser/handlers/proxy_list_method.rb, line 21 def name_with_prefix [source.xmlns_prefix, "#{source.name}"].compact.join(':') end
sequence(_)
click to toggle source
# File lib/scaffold_parser/scaffolders/xsd/parser/handlers/proxy_list_method.rb, line 49 def sequence(_) Sequence.new self end
to_builder()
click to toggle source
# File lib/scaffold_parser/scaffolders/xsd/parser/handlers/proxy_list_method.rb, line 33 def to_builder f = StringIO.new f.puts "if data.key? :#{method_name}" f.puts " element = Ox::Element.new('#{at.first}')" if item_class == 'String' f.puts " data[:#{method_name}].map { |i| Ox::Element.new('#{at.last}') << i }.each { |i| element << i }" else f.puts " data[:#{method_name}].each { |i| element << #{item_class}.new('#{at.last}', i).builder }" end f.puts ' root << element' f.puts 'end' f.string.strip end
to_h_method()
click to toggle source
# File lib/scaffold_parser/scaffolders/xsd/parser/handlers/proxy_list_method.rb, line 25 def to_h_method if item_class == 'String' "hash[:#{method_name}] = #{method_name} if has? '#{name_with_prefix}'" else "hash[:#{method_name}] = #{method_name}.map(&:to_h) if has? '#{name_with_prefix}'" end end