Sha256: e5297bcb20ea0f33b6ca82a2c013ec89b6c65f175db61464aeba0cab6565dd59

Contents?: true

Size: 555 Bytes

Versions: 4

Compression:

Stored size: 555 Bytes

Contents

module BrDanfe
  module DanfeLib
    class Options < OpenStruct
      DEFAULTOPTIONS = {
        logo_path: ""
      }

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

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
br_danfe-0.2.3 lib/br_danfe/danfe_lib/options.rb
br_danfe-0.2.2 lib/br_danfe/danfe_lib/options.rb
br_danfe-0.2.1 lib/br_danfe/danfe_lib/options.rb
br_danfe-0.2.0 lib/br_danfe/danfe_lib/options.rb