Module: Padrino::Module

Included in:
AppGem
Defined in:
lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/module.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#root(*args) ⇒ String

Helper method for file references within a Padrino module.

Examples:

module MyModule
  extend Padrino::Module
  gem! 'my_gem'
end
Module.root!

Parameters:

  • args (Array<String>)

    The directories to join to #root.

Returns:

  • (String)

    The absolute path.



32
33
34
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/module.rb', line 32

def root
  @root
end

Instance Method Details

#dependency_pathsArray<String>

Returns the list of path globs to load as dependencies Appends custom dependency patterns to the be loaded for Padrino.

Examples:

module MyModule
  extend Padrino::Module
  gem! 'my_gem'
end

Module.dependency_paths << "#{MyModule.root}/uploaders/*.rb"

Returns:

  • (Array<String>)

    The dependency paths.



51
52
53
54
55
56
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/module.rb', line 51

def dependency_paths
  [
    "#{root}/lib/**/*.rb", "#{root}/shared/lib/**/*.rb",
    "#{root}/models/**/*.rb", "#{root}/shared/models/**/*.rb"
  ]
end

#gem!(name) ⇒ Object

Register this module as being loaded from a gem. This automatically sets the root and therefore the dependency paths correctly.

Parameters:

  • name (String)

    The name of the gem. Has to be the name as stated in the gemspec.



13
14
15
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/module.rb', line 13

def gem!(name)
  self.root = Padrino.gem(name, self)
end