Method: GDstruct.create

Defined in:
lib/gdstruct.rb

.create(gds_definition, config = {}) ⇒ Hash, Array Also known as: c

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

Examples:

require 'gdstruct'

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

# => h = { a: 'value 1', b: 'value 2' }

Parameters:

  • gds_definition (String)

    GDS definition

  • config (Hash) (defaults to: {})

    a customizable set of options

Options Hash (config):

  • :allow_env (true/false) — default: false

    allow the @env directive to access environment variables, otherwise the @env directive returns nil

  • :context (Binding) — default: nil

    if a binding is set then the @r directive evaluates embedded ruby code, otherwise the @r directive returns nil

Returns:

  • (Hash, Array)

    hash/array structure



29
30
31
# File 'lib/gdstruct.rb', line 29

def create( gds_definition, config = {} )
  LDLgeneratedLanguage::Gds.parse( gds_definition, config )
end