Class: Rexer::Extension::Entity::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rexer/extension/entity.rb

Direct Known Subclasses

Plugin, Theme

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#hooksObject (readonly)

Returns the value of attribute hooks.



11
12
13
# File 'lib/rexer/extension/entity.rb', line 11

def hooks
  @hooks
end

#nameObject (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

Returns:

  • (Boolean)


15
16
17
# File 'lib/rexer/extension/entity.rb', line 15

def exist?
  path.exist? && !path.empty?
end

#pathObject



19
20
21
# File 'lib/rexer/extension/entity.rb', line 19

def path
  @path ||= root_dir.join(name.to_s)
end

#root_dirObject



13
# File 'lib/rexer/extension/entity.rb', line 13

def root_dir = raise "Not implemented"

#sourceObject



27
28
29
# File 'lib/rexer/extension/entity.rb', line 27

def source
  @source ||= Source.from_definition(definition.source)
end

#source_infoObject



23
24
25
# File 'lib/rexer/extension/entity.rb', line 23

def source_info
  @source_info ||= source.info(path)
end