Class: Arxutils::Arx
- Inherits:
-
Object
- Object
- Arxutils::Arx
- Defined in:
- lib/arxutils/arx.rb
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(data, fname) ⇒ Arx
constructor
A new instance of Arx.
Constructor Details
#initialize(data, fname) ⇒ Arx
Returns a new instance of Arx.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/arxutils/arx.rb', line 6 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 |
Instance Method Details
#create ⇒ Object
27 28 29 30 31 32 |
# File 'lib/arxutils/arx.rb', line 27 def create contents = File.open( @fname ).read erb = ERB.new(contents) content = erb.result(binding) content end |