Sha256: 8ca981012cf108cbac92a176fe0a6414d2504993eb9315f387ced59190f87b50

Contents?: true

Size: 844 Bytes

Versions: 1

Compression:

Stored size: 844 Bytes

Contents

module ScaffoldParser
  module Scaffolders
    class XSD
      class Parser
        module Handlers
          class AtMethod
            include BaseMethod
            include Utils

            def method_body
              "at '#{source.name}'"
            end

            def to_h_with_attrs_method
              "hash[:#{method_name}] = #{method_name} if has? '#{source.name}'"
            end

            def to_builder
              "root << build_element('#{source.name}', data[:#{source.name.underscore}]) if data.key? :#{source.name.underscore}"
            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

1 entries across 1 versions & 1 rubygems

Version Path
scaffold_parser-0.6.0 lib/scaffold_parser/scaffolders/xsd/parser/handlers/at_method.rb