Sha256: 55d7f57991ebdecb3b50f3e3206e6b86c5270fece8b984faf850f0ab0ee95881
Contents?: true
Size: 1013 Bytes
Versions: 2
Compression:
Stored size: 1013 Bytes
Contents
# frozen_string_literal: true require 'conifer/version' require 'conifer/file' module Conifer def self.included(base) base.extend ClassMethods end # rubocop:disable Metrics/ParameterLists module ClassMethods def conifer(name, prefix: nil, dir: nil, format: :yml, method: ::File.basename(name.to_s, ".#{format}"), singleton: false, allowed_classes: []) dir ||= ::File.expand_path(::File.dirname(caller_locations.first.path)) body = proc do return instance_variable_get("@conifer_#{method}") if instance_variable_defined?("@conifer_#{method}") instance_variable_set "@conifer_#{method}", Conifer::File.new(name, prefix: prefix, format: format, dir: dir, allowed_classes: allowed_classes).tap(&:validate!) end singleton ? define_singleton_method(method, &body) : define_method(method, &body) end # rubocop:enable Metrics/ParameterLists end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
conifer-1.3.0 | lib/conifer.rb |
conifer-1.2.1 | lib/conifer.rb |