Skip to content

Instantly share code, notes, and snippets.

@ugdark
Created September 15, 2017 11:56
Show Gist options
  • Save ugdark/58b030c9dbb25e601001729c21427685 to your computer and use it in GitHub Desktop.
Save ugdark/58b030c9dbb25e601001729c21427685 to your computer and use it in GitHub Desktop.
@configをincludeで参照できなくしたい。または代案
# frozen_string_literal: true
require 'yosenabe/config'
module Yosenabe
module Mixin
# 基本のconfigload用
module MixinConfig
# def self.included(args)
# @config = Yosenabe.config
# end
def config
# TODO: @configは隠したい
if @config.nil?
@config = Yosenabe.config
end
@config
end
end
module DummyConfig
# テストでは拡張してconfigを追加してください
def config
{}
end
end
end
end
class BoxCopy
include Yosenabe::Mixin::MixinNotifierLogger
# include Yosenabe::Mixin::DummyNotifierLogger とかで簡単に切り替えたい
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment