class Architect::Plan
Public Class Methods
new(path)
click to toggle source
# File lib/architect/plan.rb, line 9 def initialize(path) case path.kind_of? when String @yaml = YAML.load_file(path) when Hash @yaml = path else raise ArgumentError end validate end
Public Instance Methods
instances()
click to toggle source
# File lib/architect/plan.rb, line 26 def instances @yaml['instances'] end
to_s()
click to toggle source
# File lib/architect/plan.rb, line 22 def to_s @yaml end
Private Instance Methods
validate()
click to toggle source
# File lib/architect/plan.rb, line 32 def validate problems = [] problems.push 'Version number missing' unless @yaml.has_key? 'version' problems.push 'Wrong version number' unless @yaml['version'] == 1 unless problems.empty? raise InvalidPlanException, "Errors found in the plan:\n * " + problems.join("\n * ") end end