Class: Array

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

Overview

convenient for SHIORI Response treatment

Instance Method Summary collapse

Instance Method Details

#combined(separator = "\x01") ⇒ String

join \x01 separated value like “arg1\x01arg2\x01arg3” from Array

Parameters:

  • separator (String) (defaults to: "\x01")

    separator

Returns:

  • (String)

    combined strings



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

def combined(separator = "\x01")
  self.join(separator)
end

#combined2(separator1 = "\x02", separator2 = "\x01") ⇒ String

join \x01, \x02 separated value like “arg1-1\x01arg1-2\x02arg2-1\x01arg2-2” from Array of Array

Parameters:

  • separator1 (String) (defaults to: "\x02")

    1st level separator

  • separator2 (String) (defaults to: "\x01")

    2nd level separator

Returns:

  • (String)

    combined strings



93
94
95
# File 'lib/shioruby.rb', line 93

def combined2(separator1 = "\x02", separator2 = "\x01")
  self.map {|element| element.join(separator2)}.join(separator1)
end