Module: Ptool
- Defined in:
- lib/pokotarou/p_tool.rb
Class Method Summary collapse
- .gen_br_text ⇒ Object
- .gen_created_at(n = 7, datetime_str = DateTime.now.to_s, with_random_time = false) ⇒ Object
- .gen_updated_at(created_arr, with_random_time = false) ⇒ Object
Class Method Details
.gen_br_text ⇒ Object
3 4 5 |
# File 'lib/pokotarou/p_tool.rb', line 3 def gen_br_text ["text\ntext"] end |
.gen_created_at(n = 7, datetime_str = DateTime.now.to_s, with_random_time = false) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/pokotarou/p_tool.rb', line 7 def gen_created_at n = 7, datetime_str = DateTime.now.to_s, with_random_time = false datetime = DateTime.parse(datetime_str) n.times.reduce([]) do |acc, index| hours_num = 0 minutes_num = 0 hours_num, minutes_num = get_random_time() if with_random_time acc.push(datetime + index.day + hours_num.hours + minutes_num.minutes) acc end end |
.gen_updated_at(created_arr, with_random_time = false) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/pokotarou/p_tool.rb', line 20 def gen_updated_at created_arr, with_random_time = false created_arr.each.reduce([]) do |acc, created_datetime| hours_num = 5 minutes_num = 10 hours_num, minutes_num = get_random_time() if with_random_time acc.push(created_datetime + hours_num.hours + minutes_num.minutes) acc end end |