Skip to content

Commit 789c0b2

Browse files
committed
Fixed warnings about undefined instance variables. Fixes #3
1 parent c60a4a9 commit 789c0b2

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

lib/tess/api/has_content_provider.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@ module Tess
22
module API
33
module HasContentProvider
44

5-
attr_accessor :content_provider, :content_provider_id
5+
attr_accessor :content_provider
6+
attr_writer :content_provider_id
67

78
def content_provider_id
8-
@content_provider ? @content_provider.id : @content_provider_id
9+
content_provider ? content_provider.id : @content_provider_id
910
end
1011

1112
def update
12-
@content_provider.create_or_update if @content_provider && !content_provider_id
13+
content_provider.create_or_update if content_provider && !content_provider_id
1314

1415
super
1516
end
1617

1718
def create
18-
@content_provider.create_or_update if @content_provider && !content_provider_id
19+
content_provider.create_or_update if content_provider && !content_provider_id
1920

2021
super
2122
end

lib/tess/api/resource.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def to_json
2424
end
2525

2626
def [](var)
27-
self.instance_variable_get('@' + var)
27+
self.instance_variable_defined?('@' + var) ? self.instance_variable_get('@' + var) : nil
2828
end
2929

3030
# Metaprogramming!

0 commit comments

Comments
 (0)