class GDstruct

Constants

VERSION

Public Class Methods

c( gds_definition, config = {} )
Alias for: create
c_from_file( file_name, config = {} )
Alias for: create_from_file
create( gds_definition, config = {} ) click to toggle source

create a Ruby Hash/Array structure out of a GDS definition string

@param gds_definition [String] GDS definition @option config [true/false] :allow_env (false) allow the @env directive to access environment variables, otherwise the @env directive returns nil @option config [Binding] :context (nil) if a binding is set then the @r directive evaluates embedded ruby code, otherwise the @r directive returns nil

@return [Hash,Array] hash/array structure

@example

require 'gdstruct'

h = GDstruct.c( <<-EOS )
a value 1
b value 2
EOS

# => h = { a: 'value 1', b: 'value 2' }
# File lib/gdstruct.rb, line 29
def create( gds_definition, config = {} )
  LDLgeneratedLanguage::Gds.parse( gds_definition, config )
end
Also aliased as: c
create_from_file( file_name, config = {} ) click to toggle source

create a Ruby Hash/Array structure out of a GDS definition file

@param file_name [String] file name @option config [true/false] :allow_env (false) allow the @env directive to access environment variables, otherwise the @env directive returns nil @option config [Binding] :context (nil) if a binding is set then the @r directive evaluates embedded ruby code, otherwise the @r directive returns nil

@return [Hash,Array] hash/array structure

# File lib/gdstruct.rb, line 41
def create_from_file( file_name, config = {} )
  LDLgeneratedLanguage::Gds.parse( File.read( file_name ), config )
end
Also aliased as: c_from_file