Skip to content

Commit

Permalink
improving rubocop over time
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcoto committed Jun 8, 2019
1 parent 8dad43d commit 9e2d6d1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
15 changes: 15 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Metrics/MethodLength:
Max: 40
Metrics/LineLength:
Max: 150
Metrics/BlockLength:
Max: 40
Naming/PredicateName:
NamePrefixBlacklist:
- has_
Metrics/AbcSize:
Max: 30
Style/IfUnlessModifier:
Enabled: false
Style/Documentation:
Enabled: false
12 changes: 6 additions & 6 deletions lib/graphoid/definitions/types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ def generate(model)
name("#{name}Type")
description("Generated model type for #{name}")

Attribute.fields_of(model).each do |_field|
type = Graphoid::Mapper.convert(_field)
name = Utils.camelize(_field.name)
Attribute.fields_of(model).each do |attribute|
type = Graphoid::Mapper.convert(attribute)
name = Utils.camelize(attribute.name)
field(name, type)

model.class_eval do
if _field.name.include?('_')
define_method :"#{Utils.camelize(_field.name)}" do
method_name = _field.name.to_s
if attribute.name.include?('_')
define_method :"#{Utils.camelize(attribute.name)}" do
method_name = attribute.name.to_s
self[method_name] || send(method_name)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/tester_ar/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ../..
specs:
graphoid (0.0.10)
graphoid (0.1.0)
graphql (~> 1.8.0)
rails (~> 5)

Expand Down

0 comments on commit 9e2d6d1

Please sign in to comment.