class Tengine::Support::Config::Definition::Suite

Public Class Methods

new(hash_or_filepath = nil) click to toggle source
# File lib/tengine/support/config/definition/suite.rb, line 8
def initialize(hash_or_filepath = nil)
  build if respond_to?(:build)
  case hash_or_filepath
  when Hash then load(hash_or_filepath)
  when String then load_file(hash_or_filepath)
  end
end

Public Instance Methods

banner(banner = nil) click to toggle source
load_file(filepath) click to toggle source
# File lib/tengine/support/config/definition/suite.rb, line 25
def load_file(filepath)
  load(YAML.load_file(filepath))
end
mapping(mapping = nil) click to toggle source
# File lib/tengine/support/config/definition/suite.rb, line 17
def mapping(mapping = nil)
  @mapping = mapping if mapping
  @mapping
end
name_array() click to toggle source
# File lib/tengine/support/config/definition/suite.rb, line 46
def name_array
  []
end
parent() click to toggle source
# File lib/tengine/support/config/definition/suite.rb, line 22
def parent; nil; end
parse!(argv) click to toggle source
# File lib/tengine/support/config/definition/suite.rb, line 34
def parse!(argv)
  v = Tengine::Support::Config::Definition::OptparseVisitor.new(self)
  self.accept_visitor(v)
  if load_config = children.detect{|child| child.type == :load_config}
    opts = v.option_parser.getopts(argv.dup) # このdup重要。もう一度parseに使用する場合に中身が空にならないように。
    if filepath = opts[load_config.__name__.to_s]
      load_file(filepath)
    end
  end
  v.option_parser.parse(argv.dup)
end
root() click to toggle source
# File lib/tengine/support/config/definition/suite.rb, line 23
def root; self; end