Sha256: 8b0c79d71a81e3615c9bbbd94a6a1ad6f2df9922b0417593e0b1295130aae1b8

Contents?: true

Size: 544 Bytes

Versions: 3

Compression:

Stored size: 544 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.3 lib/dotremap/appdef.rb
dotremap-0.0.2 lib/dotremap/appdef.rb
dotremap-0.0.1 lib/dotremap/appdef.rb