Sha256: e702675004b32d61d8dc76b358929e9ef22d5c5fcc750b5987d7e7effdf38ab2
Contents?: true
Size: 1.48 KB
Versions: 2
Compression:
Stored size: 1.48 KB
Contents
class AssemblyInfoEngine ENGINES = { "F#" => lambda { FSharpEngine.new }, "C#" => lambda { CSharpEngine.new }, "C++.Net" => lambda { CppCliEngine.new }, "VB.Net" => lambda { VbNetEngine.new } } DEFAULT = ENGINES["C#"] def self.from_language(language) (ENGINES[language] || DEFAULT).call end def build_attribute(attr_name, attr_data) attribute = "#{@start_token}assembly: #{attr_name}(" if attr_data != nil if attr_data.is_a? Hash # Only named parameters attribute << build_named_parameters(attr_data) elsif attr_data.is_a? Array if attr_data.last.is_a? Hash # Positional and named parameters attribute << build_positional_parameters(attr_data.slice(0, attr_data.length - 1)) attribute << ", " attribute << build_named_parameters(attr_data.last) else # Only positional parameters attribute << build_positional_parameters(attr_data) end else # Single positional parameter attribute << "#{attr_data.inspect}" end end attribute << ")#{@end_token}" end def build_named_parameters(data) params = [] data.each_pair { |k, v| params << "#{k.to_s} #{@assignment} #{v.inspect}" } params.join(", ") end def build_positional_parameters(data) data.flatten.map{ |a| a.inspect }.join(", ") end def build_using_statement(namespace) "#{@using} #{namespace}#{@statement_terminator}" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
albacore-1.0.0 | lib/albacore/assemblyinfolanguages/assemblyinfoengine.rb |
albacore-1.0.0.rc.3 | lib/albacore/assemblyinfolanguages/assemblyinfoengine.rb |