Class: Middleman::Presentation::Component
- Inherits:
-
Object
- Object
- Middleman::Presentation::Component
- Includes:
- Comparable
- Defined in:
- lib/middleman-presentation-core/component.rb
Overview
A component
Direct Known Subclasses
Instance Attribute Summary collapse
-
#ignorable_files ⇒ Object
readonly
Returns the value of attribute ignorable_files.
-
#importable_files ⇒ Object
readonly
Returns the value of attribute importable_files.
-
#loadable_files ⇒ Object
readonly
Returns the value of attribute loadable_files.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#output_paths ⇒ Object
readonly
Returns the value of attribute output_paths.
-
#resource_locator ⇒ String
readonly
Return resource locator.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#base_path ⇒ Object
Base path for component.
-
#fetchable? ⇒ Boolean
Should middleman-presentation fetch the component.
-
#initialize(resource_locator: nil, version: nil, name: nil, github: nil, importable_files: [], loadable_files: [], ignorable_files: [], output_paths: []) ⇒ Component
constructor
Create new component.
-
#path ⇒ Object
Return path to component.
-
#root_directory ⇒ Object
Configure accessor for root directory.
-
#root_directory= ⇒ Object
Configure accessor for root directory.
Constructor Details
#initialize(resource_locator: nil, version: nil, name: nil, github: nil, importable_files: [], loadable_files: [], ignorable_files: [], output_paths: []) ⇒ Component
Create new component
rubocop:disable Metrics/ParameterLists
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/middleman-presentation-core/component.rb', line 21 def initialize( resource_locator: nil, version: nil, name: nil, github: nil, importable_files: [], loadable_files: [], ignorable_files: [], output_paths: [] ) @name = name @resource_locator = resource_locator @version = version @github = github @loadable_files = Array(loadable_files).map { |o| Regexp.new o } @importable_files = Array(importable_files).map { |o| Regexp.new o } @ignorable_files = Array(ignorable_files).map { |o| Regexp.new o } @output_paths = Array(output_paths) end |
Instance Attribute Details
#ignorable_files ⇒ Object (readonly)
Returns the value of attribute ignorable_files.
8 9 10 |
# File 'lib/middleman-presentation-core/component.rb', line 8 def ignorable_files @ignorable_files end |
#importable_files ⇒ Object (readonly)
Returns the value of attribute importable_files.
8 9 10 |
# File 'lib/middleman-presentation-core/component.rb', line 8 def importable_files @importable_files end |
#loadable_files ⇒ Object (readonly)
Returns the value of attribute loadable_files.
8 9 10 |
# File 'lib/middleman-presentation-core/component.rb', line 8 def loadable_files @loadable_files end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/middleman-presentation-core/component.rb', line 8 def name @name end |
#output_paths ⇒ Object (readonly)
Returns the value of attribute output_paths.
8 9 10 |
# File 'lib/middleman-presentation-core/component.rb', line 8 def output_paths @output_paths end |
#resource_locator ⇒ String (readonly)
Return resource locator
76 77 78 |
# File 'lib/middleman-presentation-core/component.rb', line 76 def resource_locator @resource_locator end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
8 9 10 |
# File 'lib/middleman-presentation-core/component.rb', line 8 def version @version end |
Instance Method Details
#<=>(other) ⇒ Object
81 82 83 |
# File 'lib/middleman-presentation-core/component.rb', line 81 def <=>(other) name.to_s <=> other.name.to_s end |
#base_path ⇒ Object
Base path for component
The path where the component can be found.
53 54 55 |
# File 'lib/middleman-presentation-core/component.rb', line 53 def base_path fail NoMethodError, :base_path end |
#fetchable? ⇒ Boolean
Should middleman-presentation fetch the component
68 69 70 |
# File 'lib/middleman-presentation-core/component.rb', line 68 def fetchable? false end |
#path ⇒ Object
Return path to component
If root directory is set, it will be prepended to name.
46 47 48 |
# File 'lib/middleman-presentation-core/component.rb', line 46 def path fail NoMethodError, :path end |
#root_directory ⇒ Object
Configure accessor for root directory
58 59 60 |
# File 'lib/middleman-presentation-core/component.rb', line 58 def root_directory fail NoMethodError, :root_directory end |
#root_directory= ⇒ Object
Configure accessor for root directory
63 64 65 |
# File 'lib/middleman-presentation-core/component.rb', line 63 def root_directory=(*) fail NoMethodError, :root_directory= end |