summaryrefslogtreecommitdiff
path: root/lib/rss
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rss')
-rw-r--r--lib/rss/maker/base.rb56
-rw-r--r--lib/rss/maker/image.rb16
-rw-r--r--lib/rss/rss.rb86
3 files changed, 79 insertions, 79 deletions
diff --git a/lib/rss/maker/base.rb b/lib/rss/maker/base.rb
index 88ea831164..78fc9f8acb 100644
--- a/lib/rss/maker/base.rb
+++ b/lib/rss/maker/base.rb
@@ -51,7 +51,7 @@ module RSS
module_eval(<<-EOC, __FILE__, __LINE__ + 1)
def new_#{name}
- #{name} = self.class::#{klass_name}.new(@maker)
+ #{name} = self.class::#{klass_name}.new(@maker)
@#{plural} << #{name}
if block_given?
yield #{name}
@@ -63,14 +63,14 @@ module RSS
def to_feed(*args)
@#{plural}.each do |#{name}|
- #{name}.to_feed(*args)
+ #{name}.to_feed(*args)
end
end
def replace(elements)
@#{plural}.replace(elements.to_a)
end
- EOC
+ EOC
end
def def_classed_element_without_accessor(name, class_name=nil)
@@ -88,7 +88,7 @@ module RSS
def make_#{name}
self.class::#{class_name}.new(@maker)
end
- EOC
+ EOC
end
def def_classed_element(name, class_name=nil, attribute_name=nil)
@@ -106,7 +106,7 @@ module RSS
def #{name}=(new_value)
@#{name}.#{attribute_name} = new_value
end
- EOC
+ EOC
else
attr_reader name
end
@@ -126,17 +126,17 @@ module RSS
end
module_eval(<<-EOC, __FILE__, __LINE__ + 1)
def #{name}
- #{local_variable_name} = #{plural_name}.first
- #{local_variable_name} ? #{local_variable_name}.#{attribute} : nil
+ #{local_variable_name} = #{plural_name}.first
+ #{local_variable_name} ? #{local_variable_name}.#{attribute} : nil
end
def #{name}=(#{new_value_variable_name})
- #{local_variable_name} =
- #{plural_name}.first || #{plural_name}.new_#{new_name}
- #{additional_setup_code}
- #{local_variable_name}.#{attribute} = #{new_value_variable_name}
+ #{local_variable_name} =
+ #{plural_name}.first || #{plural_name}.new_#{new_name}
+ #{additional_setup_code}
+ #{local_variable_name}.#{attribute} = #{new_value_variable_name}
end
- EOC
+ EOC
end
def def_other_element(name)
@@ -153,7 +153,7 @@ module RSS
current.#{name} = @#{name}
end
end
- EOC
+ EOC
end
def def_csv_element(name, type=nil)
@@ -167,7 +167,7 @@ module RSS
def #{name}=(value)
@#{name} = Utils::CSV.parse(value)#{converter}
end
- EOC
+ EOC
end
end
@@ -308,7 +308,7 @@ module RSS
def ensure_xml_content(content)
xhtml_uri = ::RSS::Atom::XHTML_URI
unless content.is_a?(RSS::XML::Element) and
- ["div", xhtml_uri] == [content.name, content.uri]
+ ["div", xhtml_uri] == [content.name, content.uri]
children = content
children = [children] unless content.is_a?(Array)
children = set_xhtml_uri_as_default_uri(children)
@@ -331,7 +331,7 @@ module RSS
def set_xhtml_uri_as_default_uri(children)
children.collect do |child|
if child.is_a?(RSS::XML::Element) and
- child.prefix.nil? and child.uri.nil?
+ child.prefix.nil? and child.uri.nil?
RSS::XML::Element.new(child.name, nil, ::RSS::Atom::XHTML_URI,
child.attributes.dup,
set_xhtml_uri_as_default_uri(child.children))
@@ -385,7 +385,7 @@ module RSS
}
_language = language
if _language and
- !dc_languages.any? {|dc_language| dc_language.value == _language}
+ !dc_languages.any? {|dc_language| dc_language.value == _language}
dc_language = self.class::DublinCoreLanguages::DublinCoreLanguage.new(self)
dc_language.value = _language.dup
dc_languages.unshift(dc_language)
@@ -417,7 +417,7 @@ module RSS
def make_#{element}
self.class::#{Utils.to_class_name(element)}.new(self)
end
- EOC
+ EOC
end
attr_reader :feed_version
@@ -500,9 +500,9 @@ module RSS
end
[
- ["link", "href", Proc.new {|target,| "#{target}.href = 'self'"}],
- ["author", "name"],
- ["contributor", "name"],
+ ["link", "href", Proc.new {|target,| "#{target}.href = 'self'"}],
+ ["author", "name"],
+ ["contributor", "name"],
].each do |name, attribute, additional_setup_maker|
def_classed_elements(name, attribute, &additional_setup_maker)
end
@@ -511,7 +511,7 @@ module RSS
managingEditor webMaster rating docs ttl).each do |element|
attr_accessor element
add_need_initialize_variable(element)
- end
+ end
%w(date lastBuildDate).each do |date_element|
attr_reader date_element
@@ -713,12 +713,12 @@ module RSS
end
[
- ["author", "name"],
- ["link", "href", Proc.new {|target,| "#{target}.href = 'alternate'"}],
- ["contributor", "name"],
+ ["author", "name"],
+ ["link", "href", Proc.new {|target,| "#{target}.href = 'alternate'"}],
+ ["contributor", "name"],
].each do |name, attribute|
def_classed_elements(name, attribute)
- end
+ end
%w(comments id published).each do |element|
attr_accessor element
@@ -795,10 +795,10 @@ module RSS
%w(authors categories contributors generator icon
logo rights subtitle title).each do |name|
def_classed_element(name)
- end
+ end
[
- ["link", "href"],
+ ["link", "href"],
].each do |name, attribute|
def_classed_elements(name, attribute)
end
diff --git a/lib/rss/maker/image.rb b/lib/rss/maker/image.rb
index e2b36e0a08..6b8f4f8e57 100644
--- a/lib/rss/maker/image.rb
+++ b/lib/rss/maker/image.rb
@@ -13,11 +13,11 @@ module RSS
end
def self.install_image_item(klass)
- klass.module_eval(<<-EOC, __FILE__, __LINE__ + 1)
+ klass.module_eval(<<-EOC, __FILE__, __LINE__ + 1)
class ImageItem < ImageItemBase
DublinCoreModel.install_dublin_core(self)
end
-EOC
+ EOC
end
class ImageItemBase < Base
@@ -29,9 +29,9 @@ EOC
add_need_initialize_variable("image_width")
add_need_initialize_variable("image_height")
alias width= image_width=
- alias width image_width
+ alias width image_width
alias height= image_height=
- alias height image_height
+ alias height image_height
def have_required_values?
@about
@@ -57,7 +57,7 @@ EOC
end
def self.install_image_favicon(klass)
- klass.module_eval(<<-EOC, __FILE__, __LINE__ + 1)
+ klass.module_eval(<<-EOC, __FILE__, __LINE__ + 1)
class ImageFavicon < ImageFaviconBase
DublinCoreModel.install_dublin_core(self)
end
@@ -73,9 +73,9 @@ EOC
alias size image_size
alias size= image_size=
- def have_required_values?
- @about and @image_size
- end
+ def have_required_values?
+ @about and @image_size
+ end
def to_feed(feed, current)
if current.respond_to?(:image_favicon=) and have_required_values?
diff --git a/lib/rss/rss.rb b/lib/rss/rss.rb
index 82ab6c7cd3..5be6a2fbaa 100644
--- a/lib/rss/rss.rb
+++ b/lib/rss/rss.rb
@@ -5,27 +5,27 @@ class Time
unless respond_to?(:w3cdtf)
def w3cdtf(date)
if /\A\s*
- (-?\d+)-(\d\d)-(\d\d)
- (?:T
- (\d\d):(\d\d)(?::(\d\d))?
- (\.\d+)?
- (Z|[+-]\d\d:\d\d)?)?
- \s*\z/ix =~ date and (($5 and $8) or (!$5 and !$8))
- datetime = [$1.to_i, $2.to_i, $3.to_i, $4.to_i, $5.to_i, $6.to_i]
- usec = 0
- usec = $7.to_f * 1000000 if $7
- zone = $8
- if zone
- off = zone_offset(zone, datetime[0])
- datetime = apply_offset(*(datetime + [off]))
- datetime << usec
- time = Time.utc(*datetime)
- time.localtime unless zone_utc?(zone)
- time
- else
- datetime << usec
- Time.local(*datetime)
- end
+ (-?\d+)-(\d\d)-(\d\d)
+ (?:T
+ (\d\d):(\d\d)(?::(\d\d))?
+ (\.\d+)?
+ (Z|[+-]\d\d:\d\d)?)?
+ \s*\z/ix =~ date and (($5 and $8) or (!$5 and !$8))
+ datetime = [$1.to_i, $2.to_i, $3.to_i, $4.to_i, $5.to_i, $6.to_i]
+ usec = 0
+ usec = $7.to_f * 1000000 if $7
+ zone = $8
+ if zone
+ off = zone_offset(zone, datetime[0])
+ datetime = apply_offset(*(datetime + [off]))
+ datetime << usec
+ time = Time.utc(*datetime)
+ time.localtime unless zone_utc?(zone)
+ time
+ else
+ datetime << usec
+ Time.local(*datetime)
+ end
else
raise ArgumentError.new("invalid date: #{date.inspect}")
end
@@ -209,7 +209,7 @@ module RSS
else
''
end
-EOC
+ EOC
end
end
alias_method(:install_have_attribute_element, :install_have_child_element)
@@ -230,7 +230,7 @@ EOC
rv << value if /\\A\\s*\\z/ !~ value
end
rv.join("\n")
-EOC
+ EOC
end
end
@@ -259,12 +259,12 @@ EOC
else
rv << value
end
- rv << "</#{elem_name}>"
+ rv << "</#{elem_name}>"
rv
else
''
end
-EOC
+ EOC
end
end
@@ -290,12 +290,12 @@ EOC
else
rv << value
end
- rv << "</#{elem_name}>"
+ rv << "</#{elem_name}>"
rv
else
''
end
-EOC
+ EOC
end
end
@@ -307,10 +307,10 @@ EOC
add_to_element_method(method_name)
module_eval(<<-EOC, *get_file_and_line_from_caller(2))
def #{method_name}(need_convert=true, indent='')
- #{yield(name, elem_name)}
+ #{yield(name, elem_name)}
end
private :#{method_name}
-EOC
+ EOC
end
def inherit_convert_attr_reader(*attrs)
@@ -323,14 +323,14 @@ EOC
def #{attr}
if @#{attr}
- #{attr}_without_inherit
+ #{attr}_without_inherit
elsif @parent
@parent.#{attr}
else
nil
end
end
-EOC
+ EOC
end
end
@@ -351,7 +351,7 @@ EOC
"\#{base}\#{value}"
end
end
-EOC
+ EOC
end
end
@@ -362,7 +362,7 @@ EOC
def #{attr}
convert(@#{attr})
end
-EOC
+ EOC
end
end
@@ -408,7 +408,7 @@ EOC
@#{attr}.join(#{separator.dump})
end
end
- EOC
+ EOC
end
end
@@ -448,7 +448,7 @@ EOC
end
end
-EOC
+ EOC
end
def integer_writer(name, disp_name=name)
@@ -468,7 +468,7 @@ EOC
end
end
end
-EOC
+ EOC
end
def positive_integer_writer(name, disp_name=name)
@@ -490,7 +490,7 @@ EOC
end
end
end
-EOC
+ EOC
end
def boolean_writer(name, disp_name=name)
@@ -510,7 +510,7 @@ EOC
end
end
end
-EOC
+ EOC
end
def text_type_writer(name, disp_name=name)
@@ -522,7 +522,7 @@ EOC
end
@#{name} = new_value
end
-EOC
+ EOC
end
def content_writer(name, disp_name=name)
@@ -536,7 +536,7 @@ EOC
@#{name}.content = new_value
end
end
-EOC
+ EOC
end
def yes_clean_other_writer(name, disp_name=name)
@@ -603,7 +603,7 @@ EOC
end
end
alias_method(:set_#{accessor_name}, :#{accessor_name}=)
-EOC
+ EOC
end
end
@@ -630,7 +630,7 @@ EOC
value = __send__(var)
next if value.nil?
if value.respond_to?("setup_maker") and
- !not_need_to_call_setup_maker_variables.include?(var)
+ !not_need_to_call_setup_maker_variables.include?(var)
value.setup_maker(target)
else
setter = "#{var}="
@@ -1173,7 +1173,7 @@ EOC
else
if name == tag
if models[i+1] and models[i+1][0] != name and
- tags and tags.first == name
+ tags and tags.first == name
raise TooMuchTagError.new(name, tag_name)
end
else