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.



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

def initialize value = nil
  self.value = value
end

Class Attribute Details

.hostObject



69
70
71
72
# File 'lib/hermeneutics/types.rb', line 69

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

Instance Attribute Details

#valueObject

Returns the value of attribute value.



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

def value
  @value
end

Class Method Details

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

Yields:

  • ($')


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

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

Instance Method Details

#encodeObject Also known as: inspect



89
90
91
# File 'lib/hermeneutics/types.rb', line 89

def encode
  "<#{self}>"
end

#to_sObject Also known as: quote



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

def to_s ; @value ; end