I have a set of modules that contain methods intended for the class
level. As such, does in make more sense to use straight interface:
class Foo
extend ModuleInQuestion
...
end
Or, would you say it is better to refactor to use more idiomatic
inclusion, using some form ClassMethods/included callback allowing:
class Foo
include ModuleInQuestion
...
end
What say you?
It may not be within your use case, though recent work using MVC-DCI
has resulted in interesting gems such as ‘mixology’.
MarkT
Thomas S. wrote in post #1053450:
I have a set of modules that contain methods intended for the class
level. As such, does in make more sense to use straight interface:
class Foo
extend ModuleInQuestion
...
end
Or, would you say it is better to refactor to use more idiomatic
inclusion, using some form ClassMethods/included callback allowing:
class Foo
include ModuleInQuestion
...
end
What say you?
Use #extend because include will also place methods in the scope of
instances which is not what you want. Note: you can make it work with
include but IMHO that makes things overly complicated.
Kind regards
robert