Sha256: fb84926e06bd3cf908cb408f2f61813c024e832073650aaa5d290c7c8dc68a14

Contents?: true

Size: 564 Bytes

Versions: 3

Compression:

Stored size: 564 Bytes

Contents

class Dotremap::Appdef
  AVAILABLE_OPTIONS = %i(
    equal
    prefix
    suffix
  ).freeze

  def initialize(appname, options)
    @childs = []
    @appname = appname

    options.each do |option, value|
      raise "Unavailable option: #{property}" unless AVAILABLE_OPTIONS.include?(option)
      @childs << Dotremap::Property.new(option, value)
    end
  end

  def to_xml
    [
      "<appdef>",
      [
        "<appname>#{@appname}</appname>",
        *@childs.map(&:to_xml),
      ].join("\n").gsub(/^/, "  "),
      "</appdef>",
    ].join("\n")
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dotremap-0.0.6 lib/dotremap/appdef.rb
dotremap-0.0.5 lib/dotremap/appdef.rb
dotremap-0.0.4 lib/dotremap/appdef.rb