class Monofile::Builder

Public Class Methods

new( monofile ) click to toggle source
# File lib/monofile/monofile.rb, line 30
def initialize( monofile )
  @monofile = monofile
end

Public Instance Methods

project( *args ) click to toggle source
# File lib/monofile/monofile.rb, line 34
def project( *args )
  ## auto-convert symbols to string
  args = args.map do |arg|
                    arg.is_a?( Symbol ) ? arg.to_s : arg
                  end

  project = Project.new( *args )
  @monofile.projects << project
end
projects( *args ) click to toggle source

adding many projects at once (by batch) - keep - why? why not?

# File lib/monofile/monofile.rb, line 46
def projects( *args )
  ## note: for now only support (list of) hash
  ##  add more later (nested array or text or such) - why? why not?
  args.each do |arg|
    raise ArgumentError, "expected Hash type - got: #{arg.inspect} : #{arg.class.name}"  unless arg.is_a?( Hash )
  end

  ## pp arg
  args.each do |arg|
    arg.each do |org, names|
      names.each do |name|
        ## puts "adding #{org} #{name}"
        project( org, name )
      end
    end
  end
end