Sha256: 3d547fddab42c66342ce026479047149c48ff896435b6721ee7d9a7c0abe8cab
Contents?: true
Size: 1020 Bytes
Versions: 5
Compression:
Stored size: 1020 Bytes
Contents
require 'concerned/module_ext' module Concerned def self.included(base) base.extend MetaMethods end module MetaMethods attr_writer :my_concerns, :my_shared_concerns def all_my_concerns my_concerns + my_shared_concerns end def my_concerns @my_concerns ||= [] end def my_shared_concerns @my_shared_concerns ||= [] end end class << self def require_shared concern require_method "shared/#{concern.to_s.underscore}" end def shared_const concern_ns concern_ns.constantize rescue NameError shared_ns_const concern_ns end def shared_ns_const concern_ns const_name = "Shared::#{concern_ns}" const_name.constantize rescue NameError raise "No module could be found for: #{concern_ns} or #{const_name}" end def extend_enable! @extend_enabled = true end def extend_disable! @extend_enabled = false end def extend_enabled? @extend_enabled end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
concerned-0.1.6 | lib/concerned.rb |
concerned-0.1.5 | lib/concerned.rb |
concerned-0.1.4 | lib/concerned.rb |
concerned-0.1.3 | lib/concerned.rb |
concerned-0.1.2 | lib/concerned.rb |