Class: Hermeneutics::Id

Inherits:
String
  • Object
show all
Defined in:
lib/hermeneutics/types.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from String

#eat_lines, #rewind, #to_gray, #to_rgb

Constructor Details

#initialize(id = nil) ⇒ Id

Returns a new instance of Id.



73
74
75
# File 'lib/hermeneutics/types.rb', line 73

def initialize id = nil
  super id || generate
end

Class Attribute Details

.hostObject



63
64
65
# File 'lib/hermeneutics/types.rb', line 63

def host
  @host ||= socket.gethostname
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



72
73
74
# File 'lib/hermeneutics/types.rb', line 72

def id
  @id
end

Class Method Details

.parse(str) {|$'| ... } ⇒ Object

Yields:

  • ($')


66
67
68
69
70
# File 'lib/hermeneutics/types.rb', line 66

def parse str
  str =~ /<(.*?)>/
  yield $' if block_given?
  $1
end

Instance Method Details

#encodeObject Also known as: inspect



77
78
79
# File 'lib/hermeneutics/types.rb', line 77

def encode
  "<#{self}>"
end