logfiction 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 162ac121bd2301e280c2356317b0b402a01d6614f30790c0474149e6a08474ca
4
- data.tar.gz: 4789b4a0b9a13d1a761fdfeb20e25d9d8af321224e1ab693c82f381ad1cb42ae
3
+ metadata.gz: 47d3f6118948e68e08a99df9c4bb1ecded3eb022b2e7b895947855614fbce4cd
4
+ data.tar.gz: 00b64f911225769a062722f0e92594501de25465b82a08b5aa2293128cca4d3e
5
5
  SHA512:
6
- metadata.gz: 280807f16e592033080bc0de0192ae01b3962fb4590fe38b4c6354c25904f17d95ff8f9c21e935742a22000e2fca7461ed7f525bc940f8479f2699ffa1ea92a9
7
- data.tar.gz: 344c49ac6037f3d804d8ea885a317a279101f84e81ab571360ca02dc4d43b3bbf8792ef15569fd1abe37cf1dd347295bccfa0e9408176d7c50a33592392e1a44
6
+ metadata.gz: b84d23d3d0e823e458841d03ab2f0927db86076a607f64aa79adbe10a1a093840dd6acd8cf67aa1a616eaa4389edc00dee0ff8b0a3576a2ad1507c40ec8351b5
7
+ data.tar.gz: 79c67ccd0bc6dfcf2b6b25ee1a7f93de74f4db47fb49c57db0705f0f0b6338a15fee4cca212579b0500b78d7ff04d1ec0d68ce936005b7493325374d6de857b7
@@ -1,3 +1,3 @@
1
1
  module Logfiction
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/logfiction.rb CHANGED
@@ -19,7 +19,7 @@ module Logfiction
19
19
  @transitions = []
20
20
  @auto_transiton = {}
21
21
  @assumptions = {}
22
- @access_log = {}
22
+ @access_log = {}
23
23
  # access_log: user_id & seuquence of states
24
24
  # ex.) {user_id1(int):
25
25
  # [{timestamp: timestamp(str),
@@ -321,7 +321,11 @@ module Logfiction
321
321
  # Output:
322
322
  # n_actions(int): total number of user's actions
323
323
  # n_sessions: total number of user's sessions
324
- def generate_accesslog(n=10000, output_form)
324
+ def generate_accesslog(n_max, output_form={})
325
+
326
+ # initialize access_log
327
+ @access_log = {}
328
+
325
329
 
326
330
  # set default value unless another manual settting done
327
331
  if @transitions.size == 0
@@ -337,7 +341,7 @@ module Logfiction
337
341
  end
338
342
 
339
343
  n_row = 1
340
- while n_row < n
344
+ while n_row < n_max
341
345
  @users.each do |user|
342
346
  user_id = user[:user_id]
343
347
  n_actions = 0
@@ -350,10 +354,10 @@ module Logfiction
350
354
  end
351
355
  end
352
356
  end
353
- self.output_accesslog(n=10000, output_form={})
357
+ self.output_accesslog(n_max, output_form)
354
358
  end
355
359
 
356
- def output_accesslog(n=10000, output_form={})
360
+ def output_accesslog(n_max, output_form)
357
361
  # default settings
358
362
  output_form = {
359
363
  basic_log: [:timestamp, :user_id, :state_id, :items],
@@ -397,7 +401,7 @@ module Logfiction
397
401
  end
398
402
  end
399
403
  end
400
- output_accesslogs.sort{|a, b| a[:timestamp] <=> b[:timestamp]}
404
+ output_accesslogs.sort{|a, b| a[:timestamp] <=> b[:timestamp]}[0,n_max]
401
405
  end
402
406
 
403
407
  def export_logfile(n_max=10000, filetype='CSV', filepath='./fiction_log.csv')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logfiction
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - rilmayer