Class: TrisulRP::Keys::HostInterface

Inherits:
Object
  • Object
show all
Defined in:
lib/trisulrp/keys.rb

Class Method Summary collapse

Class Method Details

.invert_xform(dstring) {|ret| ... } ⇒ Object

human string to key

Yields:

  • (ret)


151
152
153
154
155
156
# File 'lib/trisulrp/keys.rb', line 151

def self.invert_xform(dstring)
  parts=dstring.split('_')
  ret = Host.invert_xform(parts[0]) + "_" + HNumber.invert_xform(4,parts[1])
  yield ret if block_given?
  ret
end

.is_human_form?(patt) ⇒ Boolean

is_human_pattern?

Returns:

  • (Boolean)


166
167
168
169
# File 'lib/trisulrp/keys.rb', line 166

def self.is_human_form? patt
  parts = patt.split('_')
  parts.size == 2 and Host.is_human_form?(parts[0]) and HNumber.is_human_form?(parts[1])
end

.is_key_form?(patt) ⇒ Boolean

is_key_pattern?

Returns:

  • (Boolean)


159
160
161
162
163
# File 'lib/trisulrp/keys.rb', line 159

def self.is_key_form? patt
  return false if patt.nil?
  parts = patt.split('_')
  parts.size == 2 and Host.is_key_form?(parts[0]) and HNumber.is_key_form?(parts[1])
end

.xform(kstring) {|ret| ... } ⇒ Object

key to human string

> key - 00.00.00.00/10

Yields:

  • (ret)


143
144
145
146
147
148
# File 'lib/trisulrp/keys.rb', line 143

def self.xform(kstring)
  parts=kstring.split('_')
  ret = Host.xform(parts[0]) + "_" + HNumber.xform(parts[1])
  yield ret if block_given?
  ret
end