lib/shirinji/scope.rb in shirinji-0.0.2 vs lib/shirinji/scope.rb in shirinji-0.0.3

- old
+ new

@@ -16,18 +16,15 @@ @klass_suffix = options[:klass_suffix] instance_eval(&block) if block end - def bean(name, klass: nil, value: nil, access: :singleton, &block) + def bean(name, klass: nil, **others, &block) chunks = [mod, "#{klass}#{klass_suffix}"].compact - options = { - access: access, - klass: klass ? chunks.join('::') : nil, - value: value - } + options = others.merge(klass: klass ? chunks.join('::') : nil) + scoped_name = [prefix, name, suffix].compact.join('_') - parent.bean([prefix, name, suffix].compact.join('_'), **options, &block) + parent.bean(scoped_name, **options, &block) end def scope(**options, &block) Scope.new(self, **options, &block) end