Sha256: 216d49c42ca3c108b8a9cdb8a9e8cc874e3e24ab8548a80a70d8ac246cf07f4d

Contents?: true

Size: 965 Bytes

Versions: 3

Compression:

Stored size: 965 Bytes

Contents

require_relative '../args/import'
require_relative '../import/yaml_importer'
require_relative '../errors_warnings/warn_unexpected_params'

module Squib
  # DSL method. See http://squib.readthedocs.io
  def yaml(opts = {}, &block)
    DSL::Yaml.new(__callee__).run(opts, &block)
  end
  module_function :yaml

  class Deck
    # DSL method. See http://squib.readthedocs.io
    def yaml(opts = {}, &block)
      DSL::Yaml.new(__callee__).run(opts, &block)
    end
  end

  module DSL
    class Yaml
      include WarnUnexpectedParams
      attr_reader :dsl_method, :block

      def initialize(dsl_method)
        @dsl_method = dsl_method
      end

      def self.accepted_params
        %i( file data explode )
      end

      def run(opts,&block)
        warn_if_unexpected opts
        import_args = Args.extract_import opts
        importer = Squib::Import::YamlImporter.new
        importer.import_to_dataframe(import_args, &block)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
squib-0.19.0 lib/squib/dsl/yaml.rb
squib-0.19.0b lib/squib/dsl/yaml.rb
squib-0.19.0a lib/squib/dsl/yaml.rb