Sha256: a57e84823253f0b93f803c8e39d54c9552003014288e4514b983814ee318c412

Contents?: true

Size: 869 Bytes

Versions: 3

Compression:

Stored size: 869 Bytes

Contents

# This class reads an application model file and turns it into an
# ApplicationModel instance.

require_relative 'application_model'
require 'katapult/model'
require 'katapult/wui'
require 'katapult/navigation'

module Katapult
  class Parser

    def initialize
      self.application_model = Katapult::ApplicationModel.new
    end

    def parse(path_to_app_model_file)
      instance_eval File.read(path_to_app_model_file), path_to_app_model_file

      application_model
    end

    def model(name, options = {}, &block)
      application_model.add_model Model.new(name, options, &block)
    end

    def wui(name, options = {}, &block)
      application_model.add_wui WUI.new(name, options, &block)
    end

    def navigation(name)
      application_model.set_navigation Navigation.new(name)
    end

    private

    attr_accessor :application_model

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
katapult-0.1.2 lib/katapult/parser.rb
katapult-0.1.1 lib/katapult/parser.rb
katapult-0.1.0 lib/katapult/parser.rb