lib/citeproc/attributes.rb in citeproc-1.0.0.pre12 vs lib/citeproc/attributes.rb in citeproc-1.0.0
- old
+ new
@@ -21,20 +21,20 @@
alias [] read_attribute
def write_attribute(key, value)
attributes[filter_key(key)] = filter_value(value, key)
end
- alias []= write_attribute
+ alias []= write_attribute
- def attribute?(key)
- value = read_attribute key
+ def attribute?(key)
+ value = read_attribute key
- return false if value.nil?
- return false if value.respond_to?(:empty?) && value.empty?
+ return false if value.nil?
+ return false if value.respond_to?(:empty?) && value.empty?
- value.to_s !~ /^(false|no|never)$/i
- end
+ value.to_s !~ /^(false|no|never)$/i
+ end
def filter_key(key)
key.to_sym
end
@@ -47,11 +47,11 @@
def merge(other)
return self if other.nil?
case
when other.is_a?(String) && /^\s*\{/ =~ other
- other = MultiJson.decode(other, :symbolize_keys => true)
+ other = ::JSON.parse(other, :symbolize_names => true)
when other.respond_to?(:each_pair)
# do nothing
when other.respond_to?(:to_hash)
other = other.to_hash
else
@@ -81,11 +81,11 @@
}]
end
# @return [String] a JSON string representation of the attributes
def to_json
- MultiJson.encode(to_citeproc)
+ ::JSON.dump(to_citeproc)
end
# Don't expose internals to public API
private :filter_key, :filter_value
@@ -171,17 +171,17 @@
end
predicate_id = [method_id, '?'].join
if predicate && !instance_methods.include?(predicate_id)
define_method(predicate_id) do
- attribute?(field)
+ attribute?(field)
end
has_predicate = ['has_', predicate_id].join
alias_method(has_predicate, predicate_id) unless instance_methods.include?(has_predicate)
end
end
end
end
-end
\ No newline at end of file
+end