Sha256: ac31edceecaba39c6c1dcb44162d6c01378c4665d6545af33ca89ed0c591a5ae

Contents?: true

Size: 867 Bytes

Versions: 3

Compression:

Stored size: 867 Bytes

Contents

require_relative 'arg_loader'

module Squib::Args
  module_function def extract_sprue_file(opts, deck, dsl_method_default = {})
    SprueFile.new.extract! opts, deck
  end
  class SprueFile
    include ArgLoader

    def initialize(dsl_method_default = {})
      @dsl_method_default = dsl_method_default
    end

    def self.parameters
      {
        sprue: nil
      }
    end

    def self.expanding_parameters
      []
    end

    def self.params_with_units
      [] # none of them
    end

    def validate_template_file(arg)
      return nil if arg.nil?

      thefile = File.exist?(arg) ? arg : builtin(arg)
      raise "File #{File.expand_path(arg)} does not exist!" unless
        File.exist? thefile

      File.expand_path(thefile)
    end

    private

    def builtin(file)
      "#{File.dirname(__FILE__)}/../builtin/sprues/#{file}"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
squib-0.19.0 lib/squib/args/sprue_file.rb
squib-0.19.0b lib/squib/args/sprue_file.rb
squib-0.19.0a lib/squib/args/sprue_file.rb