Sha256: 998bde967ce8f3ec328e249f8ccdaa242731638b0e6fab9c208bf101adb773fb

Contents?: true

Size: 497 Bytes

Versions: 9

Compression:

Stored size: 497 Bytes

Contents

module BrDanfe
  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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
br_danfe-0.0.9 lib/br_danfe/options.rb
br_danfe-0.0.8 lib/br_danfe/options.rb
br_danfe-0.0.7 lib/br_danfe/options.rb
br_danfe-0.0.6 lib/br_danfe/options.rb
br_danfe-0.0.5 lib/br_danfe/options.rb
br_danfe-0.0.4 lib/br_danfe/options.rb
br_danfe-0.0.3 lib/br_danfe/options.rb
br_danfe-0.0.2 lib/br_danfe/options.rb
br_danfe-0.0.1 lib/br_danfe/options.rb