Sha256: a98de8681c056b5a1a0579b6009b75a351e3e5d38831ebda92319b42eee4aca6
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
require 'albacore/task_types/asmver/engine' require 'map' module Albacore::Asmver class FileGenerator DEFAULT_USINGS = %w| System.Reflection System.Runtime.CompilerServices System.Runtime.InteropServices| def initialize engine, ns, opts raise ArgumentError, 'engine is nil' unless engine raise ArgumentError, 'ns is nil' unless ns @engine = engine @ns = ns @opts = Map.new(opts) end def generate attrs = {} # https://github.com/ahoward/map/blob/master/test/map_test.rb#L374 attrs = Map.new attrs s = @opts.get(:out) { StringIO.new } # write the attributes in the namespace @engine.build_namespace @ns, s do # after namespace My.Ns.Here s << "\n" # open all namespaces to use .Net attributes @opts.get(:usings) { DEFAULT_USINGS }.each do |ns| s << @engine.build_using_statement(ns) s << "\n" end # write all attributes attrs.each do |name, data| s << @engine.build_attribute(name, data) s << "\n" end end s.string end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
albacore-2.0.0.rc.2 | lib/albacore/task_types/asmver/file_generator.rb |
albacore-2.0.0.rc.1 | lib/albacore/task_types/asmver/file_generator.rb |