Class: TrisulRP::Keys::Subnet

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)


118
119
120
121
122
123
# File 'lib/trisulrp/keys.rb', line 118

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

.is_human_form?(patt) ⇒ Boolean

is_human_pattern?

Returns:

  • (Boolean)


133
134
135
136
# File 'lib/trisulrp/keys.rb', line 133

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)


126
127
128
129
130
# File 'lib/trisulrp/keys.rb', line 126

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_8888

Yields:

  • (ret)


110
111
112
113
114
115
# File 'lib/trisulrp/keys.rb', line 110

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