Method: BxBuilderChain::Loader#load

Defined in:
lib/bx_builder_chain/loader.rb

#load {|String, Hash| ... } ⇒ Data

Load data from a file or URL

loader = BxBuilderChain::Loader.new("README.md")
# Load data using default processor for the file
loader.load

# Load data using a custom processor
loader.load do |raw_data, options|
  # your processing code goes here
  # return data at the end here
end

Yields:

  • (String, Hash)

    handle parsing raw output into string directly

Yield Parameters:

  • raw_data (String)

    from the loaded URL or file

Yield Returns:

  • (String)

    parsed data, as a String



78
79
80
81
82
83
# File 'lib/bx_builder_chain/loader.rb', line 78

def load(&block)
  return process_data(load_from_url, &block) if url?
  return load_from_directory(&block) if directory?

  process_data(load_from_path, &block)
end