Sha256: 1e2b6a72027c198297fe7dbc41211a06a91e4b784c6a79da35fbdbaedffe7d0d

Contents?: true

Size: 862 Bytes

Versions: 2

Compression:

Stored size: 862 Bytes

Contents

require "dotremap/namespace"
require "dotremap/property"
require "dotremap/remap"
require "dotremap/invoke_history"

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

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

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

  def invoke(application)
    Dotremap::InvokeHistory.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)
      add_child(property)
    else
      super
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dotremap-0.0.8 lib/dotremap/dsl/item.rb
dotremap-0.0.7 lib/dotremap/dsl/item.rb