Class: Hermeneutics::Id

Inherits:
Object
  • 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

Constructor Details

#initialize(value = nil) ⇒ Id

Returns a new instance of Id.



86
87
88
# File 'lib/hermeneutics/types.rb', line 86

def initialize value = nil
  self.value = value
end

Class Attribute Details

.hostObject



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

def host
  require "socket"
  @host ||= Socket.gethostname
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



85
86
87
# File 'lib/hermeneutics/types.rb', line 85

def value
  @value
end

Class Method Details

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

Yields:

  • ($')


79
80
81
82
83
# File 'lib/hermeneutics/types.rb', line 79

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

Instance Method Details

#encodeObject Also known as: inspect



95
96
97
# File 'lib/hermeneutics/types.rb', line 95

def encode
  "<#{self}>"
end

#to_sObject Also known as: quote



93
# File 'lib/hermeneutics/types.rb', line 93

def to_s ; @value ; end