simple_model_view 0.1.1 → 0.1.2

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: d922d6619f8fb27e02eacc57b7b6e8b443de2bbb91ccf873c80df796f971a79f
4
- data.tar.gz: 1b0fc673f43fdeb12ba2fff645749e7f16e6c75b68b907b667b9e7fca795ffcc
3
+ metadata.gz: 5c7265a5e0bc784320a9469265f3bef9eff3689487a3c86429c3ad756c5ea7f0
4
+ data.tar.gz: 6d2a7097ccc116fd0603d56a9314eb8636a1a6331677854298fa4ee91076b63f
5
5
  SHA512:
6
- metadata.gz: a7ac64f0364d9f030cfabf64e5503c0396de5f4071657da007ab36c9c75d999e18832936171166fb42b8c8657321e9938fdc2792adce6275163d505925d1386e
7
- data.tar.gz: 0b14978e38341d55be102fdbef3c6c32a41b78e768d04b89de47e05ac259e291715afd684fa8e9f97a026520d4964cadb808a43a77c31b6bbe2b63f6941debbc
6
+ metadata.gz: c72b316023ff2dadaa80907ccbc96f7942f3be8519cc31d26f3955b99c541c6c0eb17278d485aec04b8688d1c3790cb505d22fb191e98a272160d307e487d359
7
+ data.tar.gz: 73a1089d4ac63bed31b7e9fd3918f61765b3d78114227c881f98fe38617887bd90406977c876c31ae43ab7add17d90a73eb384413ebb423d90475170494367f1
data/.rubocop.yml CHANGED
@@ -77,13 +77,16 @@ Metrics/BlockLength: {Enabled: false}
77
77
  Metrics/ClassLength:
78
78
  CountComments: false
79
79
  Max: 250
80
- Metrics/CyclomaticComplexity: {Max: 7}
80
+ Metrics/CyclomaticComplexity: {Max: 11}
81
81
  Metrics/LineLength: {Max: 130}
82
82
  Metrics/MethodLength:
83
83
  Max: 30
84
84
  Exclude:
85
85
  - db/migrate/*
86
+ Metrics/ModuleLength:
87
+ Max: 200
86
88
  Metrics/ParameterLists: {CountKeywordArgs: false}
89
+ Metrics/PerceivedComplexity: {Max: 11}
87
90
 
88
91
  Naming/VariableNumber: {EnforcedStyle: snake_case}
89
92
  Naming/MemoizedInstanceVariableName: {EnforcedStyleForLeadingUnderscores: optional}
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple_model_view (0.1.0)
4
+ simple_model_view (0.1.2)
5
5
  actionview (>= 5.0)
6
6
 
7
7
  GEM
@@ -20,7 +20,7 @@ module SimpleModelView
20
20
  end
21
21
  end
22
22
 
23
- def collection_table(collection, *args, &block)
23
+ def collection_table(collection, *args)
24
24
  builder = SimpleModelView::CollectionTableBuilder.new template, collection, *args
25
25
 
26
26
  template.content_tag :table, class: :table do
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module SimpleModelView
3
+ module SimpleModelView # rubocop:disable
4
4
  module BuilderHelpers
5
5
  def format(value, type, **options)
6
6
  return if value.nil?
@@ -10,7 +10,7 @@ module SimpleModelView
10
10
 
11
11
  private
12
12
 
13
- def add_type_specific_class(value, type) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
13
+ def add_type_specific_class(value, type)
14
14
  return if value.nil?
15
15
 
16
16
  case type
@@ -49,7 +49,7 @@ module SimpleModelView
49
49
  end.keys.join(' ')
50
50
  end
51
51
 
52
- def autodetect_value_type(value) # rubocop:disable Metrics/CyclomaticComplexity
52
+ def autodetect_value_type(value)
53
53
  case value
54
54
  when Float
55
55
  :float
@@ -57,6 +57,17 @@ module SimpleModelView
57
57
  end
58
58
  end
59
59
 
60
+ def actions(*_args, **options)
61
+ template.content_tag(:tr) do
62
+ template.concat template.content_tag(:th, options[:title])
63
+ block_concat do
64
+ template.content_tag(:td) do
65
+ yield object if block_given?
66
+ end
67
+ end
68
+ end
69
+ end
70
+
60
71
  private
61
72
 
62
73
  attr_reader :template
@@ -58,7 +58,7 @@ module SimpleModelView
58
58
  end
59
59
 
60
60
  def format_string
61
- value
61
+ value.to_s
62
62
  end
63
63
 
64
64
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SimpleModelView
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_model_view
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuriy Esaulov