Sha256: d7ce9187244c3406e902c8ce63520ab56ee18acdb1cc25d555a65f6b121adc0a

Contents?: true

Size: 840 Bytes

Versions: 4

Compression:

Stored size: 840 Bytes

Contents

require "dotremap/dsl"
require "dotremap/property"
require "dotremap/remap"
require "dotremap/openurl"

module Dotremap::DSL::Item
  AVAILABLE_PROPERTIES = %i(
    name
    identifier
    autogen
  ).freeze

  def remap(target, options = {})
    remap = Dotremap::Remap.new(target, options[:to])
    childs << remap
  end

  def show_message(message)
    property = Dotremap::Property.new("autogen", "__ShowStatusMessage__ #{message}")
    childs << property
  end

  def invoke(application)
    Dotremap::Openurl.register(application)
    "VK_OPEN_URL_APP_#{application.gsub(/ /, '_')}"
  end

  private

  def method_missing(property, value = '', options = {})
    if AVAILABLE_PROPERTIES.include?(property)
      property = Dotremap::Property.new(property, value, options)
      childs << property
    else
      super
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dotremap-0.0.6 lib/dotremap/dsl/item.rb
dotremap-0.0.5 lib/dotremap/dsl/item.rb
dotremap-0.0.4 lib/dotremap/dsl/item.rb
dotremap-0.0.3 lib/dotremap/dsl/item.rb