Class: Teapot::Definition

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

Direct Known Subclasses

Configuration, Project, Target

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, package, name) ⇒ Definition

Returns a new instance of Definition.



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

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:



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

def context
  @context
end

#descriptionObject

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



53
54
55
# File 'lib/teapot/definition.rb', line 53

def description
  @description
end

#nameObject (readonly)

The name of the definition:



50
51
52
# File 'lib/teapot/definition.rb', line 50

def name
  @name
end

#packageObject (readonly)

The package in which the definition was specified:



47
48
49
# File 'lib/teapot/definition.rb', line 47

def package
  @package
end

Instance Method Details

#freezeObject



32
33
34
35
36
37
# File 'lib/teapot/definition.rb', line 32

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

#pathObject

The path that the definition is relative to:



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

def path
	@package.path
end

#pretty_print(pp) ⇒ Object



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

def pretty_print(pp)
	pp.text self.inspect
end

#to_sObject



68
69
70
# File 'lib/teapot/definition.rb', line 68

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