Class: Rexer::Extension::Entity::Base
- Inherits:
-
Object
- Object
- Rexer::Extension::Entity::Base
- Defined in:
- lib/rexer/extension/entity.rb
Instance Attribute Summary collapse
-
#hooks ⇒ Object
readonly
Returns the value of attribute hooks.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #exist? ⇒ Boolean
-
#initialize(definition) ⇒ Base
constructor
A new instance of Base.
- #path ⇒ Object
- #root_dir ⇒ Object
- #source ⇒ Object
- #source_info ⇒ Object
Constructor Details
#initialize(definition) ⇒ Base
Returns a new instance of Base.
5 6 7 8 9 |
# File 'lib/rexer/extension/entity.rb', line 5 def initialize(definition) @definition = definition @hooks = definition.hooks || {} @name = definition.name end |
Instance Attribute Details
#hooks ⇒ Object (readonly)
Returns the value of attribute hooks.
11 12 13 |
# File 'lib/rexer/extension/entity.rb', line 11 def hooks @hooks end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/rexer/extension/entity.rb', line 11 def name @name end |
Instance Method Details
#exist? ⇒ Boolean
15 16 17 |
# File 'lib/rexer/extension/entity.rb', line 15 def exist? path.exist? && !path.empty? end |
#path ⇒ Object
19 20 21 |
# File 'lib/rexer/extension/entity.rb', line 19 def path @path ||= root_dir.join(name.to_s) end |
#root_dir ⇒ Object
13 |
# File 'lib/rexer/extension/entity.rb', line 13 def root_dir = raise "Not implemented" |
#source ⇒ Object
27 28 29 |
# File 'lib/rexer/extension/entity.rb', line 27 def source @source ||= Source.from_definition(definition.source) end |
#source_info ⇒ Object
23 24 25 |
# File 'lib/rexer/extension/entity.rb', line 23 def source_info @source_info ||= source.info(path) end |