Sha256: ffb052df5cc9f5b3a5c8f9124182a6535d1d2b49823abc4c6a0ffe98d49ebdb2

Contents?: true

Size: 558 Bytes

Versions: 5

Compression:

Stored size: 558 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.exists?("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

5 entries across 5 versions & 1 rubygems

Version Path
ruby_danfe-1.15.2 lib/ruby_danfe/options.rb
ruby_danfe-1.15.1 lib/ruby_danfe/options.rb
ruby_danfe-1.15.0 lib/ruby_danfe/options.rb
ruby_danfe-1.13.2 lib/ruby_danfe/options.rb
ruby_danfe-1.11.5 lib/ruby_danfe/options.rb