class ScaffoldParser::Scaffolders::XSD::Parser::Handlers::AtMethod

Public Instance Methods

all(_) click to toggle source
# File lib/scaffold_parser/scaffolders/xsd/parser/handlers/at_method.rb, line 51
def all(_)
  All.new self
end
at() click to toggle source
# File lib/scaffold_parser/scaffolders/xsd/parser/handlers/at_method.rb, line 30
def at
  [source.xmlns_prefix, "#{source.name}"].compact.join(':')
end
choice(_) click to toggle source
# File lib/scaffold_parser/scaffolders/xsd/parser/handlers/at_method.rb, line 47
def choice(_)
  Choice.new self
end
method_body() click to toggle source
# File lib/scaffold_parser/scaffolders/xsd/parser/handlers/at_method.rb, line 26
def method_body
  "at '#{at}'"
end
sequence(_) click to toggle source
# File lib/scaffold_parser/scaffolders/xsd/parser/handlers/at_method.rb, line 43
def sequence(_)
  Sequence.new self
end
to_builder() click to toggle source
# File lib/scaffold_parser/scaffolders/xsd/parser/handlers/at_method.rb, line 39
def to_builder
  "root << build_element('#{at}', data[:#{method_name}], data[:#{method_name}_attributes]) if data.key? :#{method_name}"
end
to_h_method() click to toggle source
# File lib/scaffold_parser/scaffolders/xsd/parser/handlers/at_method.rb, line 34
def to_h_method
  "hash[:#{method_name}] = #{method_name} if has? '#{at}'\n"\
    "hash[:#{method_name}_attributes] = #{method_name}_attributes if has? '#{at}'"
end
to_s() click to toggle source
# File lib/scaffold_parser/scaffolders/xsd/parser/handlers/at_method.rb, line 10
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