Silence uninitialized variable warnings
As the community progressively moves to a useful practice of enabling ruby warnings on tests, assigning an instance variable before use becomes a necessary practice. Here we set some variables at initialization that were previously lazily or conditionally set: - `decoded` is assigned false which seems to make more semantic sense than than using nil - `namespace` is assigned nil, its value being lazily computed later - `available_namespaces` is assigned nil so as to respect the cache invalidation mechanism
This commit is contained in:
parent
ef1b8d2a28
commit
151788abad
|
@ -34,10 +34,11 @@ module Oga
|
||||||
# @option options [String] :value
|
# @option options [String] :value
|
||||||
# @option options [Oga::XML::Element] :element
|
# @option options [Oga::XML::Element] :element
|
||||||
def initialize(options = {})
|
def initialize(options = {})
|
||||||
@name = options[:name]
|
@name = options[:name]
|
||||||
@value = options[:value]
|
@value = options[:value]
|
||||||
@element = options[:element]
|
@element = options[:element]
|
||||||
|
@decoded = false
|
||||||
|
@namespace = nil
|
||||||
@namespace_name = options[:namespace_name]
|
@namespace_name = options[:namespace_name]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -34,10 +34,11 @@ module Oga
|
||||||
def initialize(options = {})
|
def initialize(options = {})
|
||||||
super
|
super
|
||||||
|
|
||||||
@name = options[:name]
|
@name = options[:name]
|
||||||
@namespace_name = options[:namespace_name]
|
@namespace_name = options[:namespace_name]
|
||||||
@attributes = options[:attributes] || []
|
@attributes = options[:attributes] || []
|
||||||
@namespaces = options[:namespaces] || {}
|
@namespaces = options[:namespaces] || {}
|
||||||
|
@available_namespaces = nil
|
||||||
|
|
||||||
link_attributes
|
link_attributes
|
||||||
register_namespaces_from_attributes
|
register_namespaces_from_attributes
|
||||||
|
|
Loading…
Reference in New Issue