Sha256: b8bc0a817eb19482e1e2af550b35cd2bb2aa7ab1c863be9ea162b4dab0ba60b1

Contents?: true

Size: 557 Bytes

Versions: 1

Compression:

Stored size: 557 Bytes

Contents

module RubyDanfe
  class Options < OpenStruct

    DEFAULTOPTIONS = {
      quantity_decimals: 2,
      numerify_prod_qcom: false
    }

    def initialize(new_options={})
      options = DEFAULTOPTIONS.merge(config_yaml_load)
      super options.merge(new_options)
    end

    private
      def file
        File.exist?("config/ruby_danfe.yml") ? File.open("config/ruby_danfe.yml").read : ""
      end

      def config_yaml_load
        @file_read = YAML.load(file)
        @file_read ? (@file_read["ruby_danfe"]||{})["options"] : {}
      end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby_danfe-1.15.4 lib/ruby_danfe/options.rb