nazar 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc538e2fec48e0daf00bd670d1c5aa204f9caa6a045397cfcf32e92d433b379f
4
- data.tar.gz: 17658ef498b4c1f9f14a8ba91e3ad53aa3de347a95302042647b8e30decd6d91
3
+ metadata.gz: 2c111b062edbb87fb756c39dcdf5628c7a71459a0f5cc98b9ae69f41894271e4
4
+ data.tar.gz: 7979ca6f048af4bd2d52ad55b62c630bbdffe570ec127bd761243c9ce88c6770
5
5
  SHA512:
6
- metadata.gz: bdd620ad635fdfde0337d339c28b570e412bbd7d7d1e6701f76cf9ad028eb92c22a77e013ad7ef7e460dd1114e2e9ffb66039ca18276455a255445ce156ccc1c
7
- data.tar.gz: 9737cb971cc7a46118640e352e90745915101f409ba5297b432e046343715e53261f17c4bad80f332ec1878ff2e8911742be5f6bdefe42e50fa280f3674187fd
6
+ metadata.gz: 37cb2ef5920b6ee84296494e7f2c6e1f13fb0f3b6736ada3eb983933d9fc7384521c4fecf9328978fd6f94a778218541b7a21e35b45df6e426374bdb7be03d6a
7
+ data.tar.gz: 85047535269ef0c782451c7c3d1c04a63f99ee4a412a1f34e557c6b951f72d54088191a7cf324eac82866c0c327f2fdb3277a8f7d2921dd43f31fb25206f63a1
checksums.yaml.gz.sig CHANGED
Binary file
@@ -10,7 +10,7 @@ module Nazar
10
10
  end
11
11
 
12
12
  def valid?
13
- collection.present?
13
+ !!collection && !collection.empty?
14
14
  end
15
15
 
16
16
  def headers
data/lib/nazar/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nazar
4
- VERSION = '0.0.4'
4
+ VERSION = '0.0.5'
5
5
  end
data/lib/nazar/view.rb CHANGED
@@ -28,6 +28,8 @@ module Nazar
28
28
 
29
29
  def formatter_klass
30
30
  @formatter_klass ||= case data
31
+ when boolean?
32
+ nil
31
33
  when acttive_record_collection?
32
34
  Formatter::ActiveRecordCollection
33
35
  when active_record_item?
@@ -41,6 +43,10 @@ module Nazar
41
43
  @formatter ||= formatter_klass.new(data)
42
44
  end
43
45
 
46
+ def boolean?
47
+ proc { data === true || data === false } # rubocop:disable Style/CaseEquality
48
+ end
49
+
44
50
  def acttive_record_collection?
45
51
  return false unless Nazar.extensions.include?(:active_record)
46
52
 
data/lib/nazar.rb CHANGED
@@ -32,7 +32,8 @@ module Nazar
32
32
  def enable!(extensions: [:active_record, :csv])
33
33
  return if @enabled
34
34
 
35
- load_active_record! if extensions.include?(:active_record) || defined?(ActiveRecord)
35
+ load_active_record! if extensions.include?(:active_record)
36
+ load_csv! if extensions.include?(:csv)
36
37
 
37
38
  enable_for_irb! if defined?(IRB)
38
39
  enable_for_pry! if defined?(Pry)
@@ -44,15 +45,15 @@ module Nazar
44
45
  extensions << :csv
45
46
 
46
47
  require 'csv'
47
- require 'nazar/formatter/csv_table'
48
+ load 'nazar/formatter/csv_table.rb'
48
49
  end
49
50
 
50
51
  def load_active_record!
51
52
  extensions << :active_record
52
53
 
53
54
  require 'active_record'
54
- require 'nazar/formatter/active_record_collection'
55
- require 'nazar/formatter/active_record_item'
55
+ load 'nazar/formatter/active_record_collection.rb'
56
+ load 'nazar/formatter/active_record_item.rb'
56
57
  end
57
58
 
58
59
  def enable_for_irb!
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nazar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michał Krzyżanowski
@@ -36,7 +36,7 @@ cert_chain:
36
36
  FlwFUDGjWAe8lcsjyGp1dox0FK91TAHdZW1op8LYnOcO2DM8Mgzu4Gp7mibATEnx
37
37
  ooN2pwmH
38
38
  -----END CERTIFICATE-----
39
- date: 2021-09-21 00:00:00.000000000 Z
39
+ date: 2021-09-23 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activerecord
metadata.gz.sig CHANGED
Binary file