Sha256: 168ca38f2c236172a8ac5e283fe3794988a0f14a23fc3f729cdcbb82ee400e98

Contents?: true

Size: 1.04 KB

Versions: 11

Compression:

Stored size: 1.04 KB

Contents

def var_collect string_var
  if string_var =~ /^.*{year}.*$/
    string_var = replace_year(string_var)
  end

  if string_var =~ /^.*{month}.*$/
    string_var = replace_month(string_var)
  end

  if string_var =~ /^.*{day}.*$/
    string_var = replace_day(string_var)
  end

  if string_var =~ /^.*{store_value}.*$/
    string_var = $context_value
  end

  return string_var
end

def replace_year str
  t = Time.now()
  return str.gsub("{year}", t.year.to_s)
end

def replace_month str
  t = Time.now()
  _month = t.month
  if _month < 10
    return str.gsub("{month}", "0#{_month.to_s}")
  else
    return str.gsub("{month}", "#{_month.to_s}")
  end
  return str
end

def replace_day str
  t = Time.now()
  _day = t.day
  if _day < 10
    return str.gsub("{day}", "0#{_day.to_s}")
  else
    return str.gsub("{day}", "#{_day.to_s}")
  end
  return str
end

def replace_pipe str_pipe
  put_log ">>>> #{str_pipe}"
  if str_pipe =~ /^.*{pipe}.*$/
    return str_pipe.gsub("{pipe}", "|")
  end
  return str_pipe
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
Ifd_Mobile-1.4.0 lib/Ifd_Mobile/methods/lib_var.rb
Ifd_Mobile-1.3.0 lib/Ifd_Mobile/methods/lib_var.rb
Ifd_Mobile-1.2.0 lib/Ifd_Mobile/methods/lib_var.rb
Ifd_Mobile-1.1.0 lib/Ifd_Mobile/methods/lib_var.rb
Ifd_Mobile-1.0.0 lib/Ifd_Mobile/methods/lib_var.rb
Ifd_Mobile-0.1.9 lib/Ifd_Mobile/methods/lib_var.rb
Ifd_Mobile-0.1.8 lib/Ifd_Mobile/methods/lib_var.rb
Ifd_Mobile-0.1.6 lib/Ifd_Mobile/methods/lib_var.rb
Ifd_Mobile-0.1.5 lib/Ifd_Mobile/methods/lib_var.rb
Ifd_Mobile-0.1.1 lib/Ifd_Mobile/methods/lib_var.rb
Ifd_Mobile-0.1.0 lib/Ifd_Mobile/methods/lib_var.rb