Class: Unfig::Loader
- Inherits:
-
Object
- Object
- Unfig::Loader
- Defined in:
- lib/unfig/loader.rb
Instance Method Summary collapse
-
#initialize(values:, argv: UNSUPPLIED, env: UNSUPPLIED, config: UNSUPPLIED, **options) ⇒ Loader
constructor
A new instance of Loader.
- #read ⇒ Object
Constructor Details
#initialize(values:, argv: UNSUPPLIED, env: UNSUPPLIED, config: UNSUPPLIED, **options) ⇒ Loader
Returns a new instance of Loader.
3 4 5 6 7 8 9 10 |
# File 'lib/unfig/loader.rb', line 3 def initialize(values:, argv: UNSUPPLIED, env: UNSUPPLIED, config: UNSUPPLIED, **) @argv = argv @env = env @config = config @values = values @format = .fetch(:format, :hash) = .fetch(:banner, nil) end |
Instance Method Details
#read ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/unfig/loader.rb', line 12 def read @_read ||= case format.to_s when "hash" then hashed_values when "struct" then struct_values when "openstruct" then openstruct_values else raise ArgumentError, "Unfig::Loader cannot return results in the format '#{format}'" end end |