Sha256: 6eb4871f7c4316063e2bcb5a57cecce1e0f65e4558b29a45a41ffe0aba6cdd13
Contents?: true
Size: 654 Bytes
Versions: 4
Compression:
Stored size: 654 Bytes
Contents
# frozen_string_literal: true module Nina class Builder # A way to call methods from initalization proc on base_class class Initialization < BasicObject attr_reader :allow_list def initialize(allow_list, atts = {}) @allow_list = allow_list @atts = atts end def method_missing(method, *args, **kwargs, &block) return super unless @allow_list.include?(method) @atts[method] = [args, kwargs, block] end def respond_to_missing?(method, include_private = false) @allow_list.include?(method) || super end def to_h @atts end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
nina-0.1.6 | lib/nina/builder/initialization.rb |
nina-0.1.5 | lib/nina/builder/initialization.rb |
nina-0.1.4 | lib/nina/builder/initialization.rb |
nina-0.1.2 | lib/nina/builder/initialization.rb |