lib/travis/client/namespace.rb in travis-1.11.1 vs lib/travis/client/namespace.rb in travis-1.12.0
- old
+ new
@@ -1,15 +1,18 @@
+# frozen_string_literal: true
+
require 'travis/client'
module Travis
module Client
class Namespace < Module
class Curry < Module
attr_accessor :namespace, :type
def initialize(namespace, type)
- @namespace, @type = namespace, type
+ @namespace = namespace
+ @type = type
end
def find_one(id = nil)
result = session.find_one(type, id)
result.curry = self
@@ -39,13 +42,13 @@
session.clear_cache!
end
private
- def session
- namespace.session
- end
+ def session
+ namespace.session
+ end
end
include Methods
attr_accessor :session
@@ -64,22 +67,23 @@
delegate_session(klass)
end
private
- def fix_names(klass)
- constants.each do |name|
- const = klass.const_get(name)
- klass.const_set(name, const) if const == const_get(name)
- end
+ def fix_names(klass)
+ constants.each do |name|
+ const = klass.const_get(name)
+ klass.const_set(name, const) if const == const_get(name)
end
+ end
- def delegate_session(klass)
- return if klass == Object or klass == Kernel
- klass.extend(Methods)
- namespace = self
- klass.define_singleton_method(:session) { namespace.session }
- klass.define_singleton_method(:session=) { |value| namespace.session = value }
- end
+ def delegate_session(klass)
+ return if [Object, Kernel].include?(klass)
+
+ klass.extend(Methods)
+ namespace = self
+ klass.define_singleton_method(:session) { namespace.session }
+ klass.define_singleton_method(:session=) { |value| namespace.session = value }
+ end
end
end
end