Class: Teapot::Definition

Inherits:
Object
  • Object
show all
Defined in:
lib/teapot/definition.rb

Overview

Base class for definitions (target, configuration, or project).

Direct Known Subclasses

Configuration, Project, Target

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, package, name) ⇒ Definition

Initialize a new definition.



13
14
15
16
17
18
19
20
# File 'lib/teapot/definition.rb', line 13

def initialize(context, package, name)
	@context = context
	@package = package
	
	@name = name
	
	@description = nil
end

Instance Attribute Details

#contextObject (readonly)

The context in which the definition was loaded:



36
37
38
# File 'lib/teapot/definition.rb', line 36

def context
  @context
end

#descriptionObject

A textual description of the definition, possibly in markdown format:



45
46
47
# File 'lib/teapot/definition.rb', line 45

def description
  @description
end

#nameObject (readonly)

The name of the definition:



42
43
44
# File 'lib/teapot/definition.rb', line 42

def name
  @name
end

#packageObject (readonly)

The package in which the definition was specified:



39
40
41
# File 'lib/teapot/definition.rb', line 39

def package
  @package
end

Instance Method Details

#freezeObject

Make the definition immutable after it has been loaded from a teapot file.



23
24
25
26
27
28
# File 'lib/teapot/definition.rb', line 23

def freeze
	@name.freeze
	@description.freeze
	
	super
end

#inspectObject



31
32
33
# File 'lib/teapot/definition.rb', line 31

def inspect
	"\#<#{self.class.name} #{@name}>"
end

#pathObject

The path that the definition is relative to:



58
59
60
# File 'lib/teapot/definition.rb', line 58

def path
	@package.path
end

#to_sObject



63
64
65
# File 'lib/teapot/definition.rb', line 63

def to_s
	"#<#{self.class} #{@name.dump}>"
end