Class: Talk::RegistryEntry
- Inherits:
-
Object
- Object
- Talk::RegistryEntry
- Defined in:
- lib/registry.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #each(&block) ⇒ Object
- #has_children? ⇒ Boolean
-
#initialize(name = nil, file = nil, line = nil) ⇒ RegistryEntry
constructor
A new instance of RegistryEntry.
- #is_entry? ⇒ Boolean
- #keys ⇒ Object
- #make_entry(name, file, line) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name = nil, file = nil, line = nil) ⇒ RegistryEntry
Returns a new instance of RegistryEntry.
13 14 15 16 17 18 |
# File 'lib/registry.rb', line 13 def initialize(name=nil, file=nil, line=nil) @file = file @line = line @name = name @children = {} end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
11 12 13 |
# File 'lib/registry.rb', line 11 def file @file end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
11 12 13 |
# File 'lib/registry.rb', line 11 def line @line end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/registry.rb', line 11 def name @name end |
Instance Method Details
#[](key) ⇒ Object
26 27 28 |
# File 'lib/registry.rb', line 26 def [](key) @children[key] end |
#[]=(key, value) ⇒ Object
30 31 32 |
# File 'lib/registry.rb', line 30 def []=(key, value) @children[key] = value end |
#each(&block) ⇒ Object
38 39 40 |
# File 'lib/registry.rb', line 38 def each(&block) @children.each &block end |
#has_children? ⇒ Boolean
42 43 44 |
# File 'lib/registry.rb', line 42 def has_children? not @children.empty? end |
#is_entry? ⇒ Boolean
46 47 48 |
# File 'lib/registry.rb', line 46 def is_entry? @file != nil end |
#keys ⇒ Object
34 35 36 |
# File 'lib/registry.rb', line 34 def keys @children.keys end |
#make_entry(name, file, line) ⇒ Object
20 21 22 23 24 |
# File 'lib/registry.rb', line 20 def make_entry(name, file, line) @name = name @file = file @line = line end |
#to_s ⇒ Object
50 51 52 |
# File 'lib/registry.rb', line 50 def to_s is_entry? ? "#{@file}:#{@line}" : "container" end |