class DTK::DSL::InputOutputCommon

Base classes for getting input from file to map to canonical form and to store canonical form that is used for generation

Private Class Methods

create_aux(type, obj = nil) click to toggle source
# File lib/dsl/input_output_common.rb, line 44
def self.create_aux(type, obj = nil)
  case type
  when :hash 
    # if obj.class not ::Hash then reified already
    (obj.nil? or obj.class == ::Hash) ? self::Hash.new(self, obj) : obj
  when :array 
    # if obj.class not ::Array then reified already
    (obj.nil? or obj.class == ::Array) ? self::Array.new(self, obj) : obj
  when :string 
    # no reification for string
    ::String.new(obj || '') 
  else 
    raise Error, "Unexpected type '#{type}'"
  end
end
obj_type(obj) click to toggle source
# File lib/dsl/input_output_common.rb, line 32
def self.obj_type(obj)
  if obj.kind_of?(::Hash)
    :hash
  elsif obj.kind_of?(::Array)
    :array
  elsif obj.kind_of?(::String)
    :string
  else
    raise Error, "Unexpected type '#{obj.class}'"
  end
end