Sha256: ff1c1f29afb627596b94d34e38bb9947d66efc993930ce5882e0271b47d0012b

Contents?: true

Size: 704 Bytes

Versions: 2

Compression:

Stored size: 704 Bytes

Contents

# -*- coding: utf-8 -*-
require 'erb'

module Arxutils
  class Arx
    def initialize( data , fname )
      @fname = fname
      # 以下のものの配列
      # :flist
      # :classname
      # :classname_downcase
      # :items
      #  フィールド名, 型, null許容 の配列
      # :plural
      # :relation
      @data = data

      @@field ||= Struct.new("Field" , :name, :type, :null ) 

      if @data[:items]
        @data[:ary] = @data[:items].map{ |x| @@field.new( *x ) }
      else
        @data[:ary] = []
      end
    end

    def create
      contents = File.open( @fname ).read
      erb = ERB.new(contents)
      content = erb.result(binding)
      content
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
arxutils-0.1.36 lib/arxutils/arx.rb
arxutils-0.1.35 lib/arxutils/arx.rb