Class: Monofile::Builder
- Inherits:
-
Object
- Object
- Monofile::Builder
- Defined in:
- lib/monofile/monofile.rb
Overview
"clean room" pattern/spell - keep accessible methods to a minimum (by eval in "cleanroom")
Instance Method Summary collapse
-
#initialize(monofile) ⇒ Builder
constructor
A new instance of Builder.
- #project(*args) ⇒ Object
-
#projects(*args) ⇒ Object
adding many projects at once (by batch) - keep - why? why not?.
Constructor Details
#initialize(monofile) ⇒ Builder
Returns a new instance of Builder.
30 31 32 |
# File 'lib/monofile/monofile.rb', line 30 def initialize( monofile ) @monofile = monofile end |
Instance Method Details
#project(*args) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# 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) ⇒ Object
adding many projects at once (by batch) - keep - why? why not?
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# 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 |