class Algo::Dsl

Constants

CLUSTER_DEFAULT

Attributes

options[R]

Public Class Methods

load(options, path = nil) click to toggle source
# File lib/algo/dsl.rb, line 17
def self.load(options, path = nil)
  dsl = new(options).tap do |dsl|
    dsl._load_from(path)
  end
  dsl.result
end
load_text(options, text) click to toggle source
# File lib/algo/dsl.rb, line 24
def self.load_text(options, text)
  dsl = new(options).tap do |dsl|
    dsl.instance_eval(text)
  end
  dsl.result
end
new(options) click to toggle source
# File lib/algo/dsl.rb, line 31
def initialize(options)
  @options = CLUSTER_DEFAULT.dup
  @options.merge!(options)
  @clusters = []
end

Public Instance Methods

_load_from(path) click to toggle source
# File lib/algo/dsl.rb, line 37
def _load_from(path)
  instance_eval(File.read(path), path) if path
end
result() click to toggle source
# File lib/algo/dsl.rb, line 13
def result
  @clusters
end