Sha256: bc12b097a4fdc0b64ca71ac5f5971823cb1611ccb08b1dabeb7097684d53634a

Contents?: true

Size: 557 Bytes

Versions: 15

Compression:

Stored size: 557 Bytes

Contents

module BrDanfe
  module DanfeLib
    class Options < OpenStruct
      DEFAULTOPTIONS = { logo: "", logo_dimensions: {} }

      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

15 entries across 15 versions & 1 rubygems

Version Path
br_danfe-0.11.1 lib/br_danfe/danfe_lib/options.rb
br_danfe-0.11.0 lib/br_danfe/danfe_lib/options.rb
br_danfe-0.10.1 lib/br_danfe/danfe_lib/options.rb
br_danfe-0.10.0 lib/br_danfe/danfe_lib/options.rb
br_danfe-0.8.0 lib/br_danfe/danfe_lib/options.rb
br_danfe-0.7.7 lib/br_danfe/danfe_lib/options.rb
br_danfe-0.7.6 lib/br_danfe/danfe_lib/options.rb
br_danfe-0.7.5 lib/br_danfe/danfe_lib/options.rb
br_danfe-0.7.4 lib/br_danfe/danfe_lib/options.rb
br_danfe-0.7.3 lib/br_danfe/danfe_lib/options.rb
br_danfe-0.7.2 lib/br_danfe/danfe_lib/options.rb
br_danfe-0.7.1 lib/br_danfe/danfe_lib/options.rb
br_danfe-0.7.0 lib/br_danfe/danfe_lib/options.rb
br_danfe-0.6.1 lib/br_danfe/danfe_lib/options.rb
br_danfe-0.6.0 lib/br_danfe/danfe_lib/options.rb