Skip to content

Instantly share code, notes, and snippets.

@paneq
Last active August 29, 2015 14:13
Show Gist options
  • Save paneq/2241f6c8aa9a0a12e2ce to your computer and use it in GitHub Desktop.
Save paneq/2241f6c8aa9a0a12e2ce to your computer and use it in GitHub Desktop.
# keep in one file
class Whatever
class A
def self.interface_method
end
end
class B
def self.interface_method
end
end
def something
end
end
class Whatever
def something
end
end
# force loading by using class names
Whatever::A
Whatever::B
class Whatever
def something
end
end
# force loading by requiring files (in a way compatibile with rails dependency tracking)
require_dependency 'whatever/a'
require_dependency 'whatever/b'
class Whatever
def something
end
def self.constants
# force loading by requiring files but only when someone needs it
require_dependency 'whatever/a'
require_dependency 'whatever/b'
super
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment