~ubuntu-branches/ubuntu/trusty/ruby1.9/trusty

« back to all changes in this revision

Viewing changes to lib/rss/0.9.rb

  • Committer: Bazaar Package Importer
  • Author(s): Lucas Nussbaum
  • Date: 2006-05-08 22:23:12 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060508222312-w2wqeaz030ifi59j
Tags: 1.9.0+20060423-3ubuntu1
* Resynchronized with Debian.
* Only change from Debian is the addition of
  debian/patches/903_sparc_fix_define.patch to fix illegal instructions
  at runtime on sparc. (change from 1.9.0+20050921-1ubuntu1)

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
      [
80
80
        [nil, 'channel'],
81
81
      ].delete_if do |uri, name|
82
 
        send(name).nil?
 
82
        __send__(name).nil?
83
83
      end
84
84
    end
85
85
 
195
195
          "textInput",
196
196
          "cloud",
197
197
        ].delete_if do |name|
198
 
          send(name).nil?
 
198
          __send__(name).nil?
199
199
        end.collect do |elem|
200
200
          [nil, elem]
201
201
        end
269
269
 
270
270
          def initialize(content=nil)
271
271
            super()
272
 
            @content = content
 
272
            self.content = content
273
273
          end
274
274
      
275
275
        end
310
310
        class Hour < Element
311
311
          include RSS09
312
312
 
313
 
          content_setup
 
313
          content_setup(:integer)
314
314
 
315
315
          def initialize(content=nil)
316
316
            super()
317
 
            @content = content
318
 
          end
319
 
 
320
 
          remove_method :content=
321
 
          def content=(value)
322
 
            @content = value.to_i
323
 
          end
324
 
          
 
317
            self.content = content
 
318
          end
325
319
        end
326
320
        
327
321
      end
334
328
          install_text_element(name)
335
329
          install_model(name, nil)
336
330
        end
337
 
        %w(width height description).each do |name|
338
 
          install_text_element(name)
 
331
        [
 
332
          ["width", :integer],
 
333
          ["height", :integer],
 
334
          ["description"],
 
335
        ].each do |name, type|
 
336
          install_text_element(name, type)
339
337
          install_model(name, "?")
340
338
        end
341
339
 
 
340
        def initialize(url=nil, title=nil, link=nil, width=nil, height=nil,
 
341
                       description=nil)
 
342
          super()
 
343
          self.url = url
 
344
          self.title = title
 
345
          self.link = link
 
346
          self.width = width
 
347
          self.height = height
 
348
          self.description = description
 
349
        end
 
350
 
342
351
        def to_s(need_convert=true, indent=calc_indent)
343
352
          rv = tag(indent) do |next_indent|
344
353
            [
358
367
        private
359
368
        def _tags
360
369
          %w(url title link width height description).delete_if do |name|
361
 
            send(name).nil?
 
370
            __send__(name).nil?
362
371
          end.collect do |elem|
363
372
            [nil, elem]
364
373
          end
375
384
        
376
385
        [
377
386
          ["domain", nil, true],
378
 
          ["port", nil, true],
 
387
          ["port", nil, true, :integer],
379
388
          ["path", nil, true],
380
389
          ["registerProcedure", nil, true],
381
 
          ["protocol", nil ,true],
382
 
        ].each do |name, uri, required|
383
 
          install_get_attribute(name, uri, required)
 
390
          ["protocol", nil, true],
 
391
        ].each do |name, uri, required, type|
 
392
          install_get_attribute(name, uri, required, type)
384
393
        end
385
394
 
386
395
        def initialize(domain=nil, port=nil, path=nil, rp=nil, protocol=nil)
387
396
          super()
388
 
          @domain = domain
389
 
          @port = port
390
 
          @path = path
391
 
          @registerProcedure = rp
392
 
          @protocol = protocol
 
397
          self.domain = domain
 
398
          self.port = port
 
399
          self.path = path
 
400
          self.registerProcedure = rp
 
401
          self.protocol = protocol
393
402
        end
394
403
 
395
404
        def to_s(need_convert=true, indent=calc_indent)
460
469
        def _tags
461
470
          rv = %w(title link description author comments
462
471
            source enclosure).delete_if do |name|
463
 
            send(name).nil?
 
472
            __send__(name).nil?
464
473
          end.collect do |name|
465
474
            [nil, name]
466
475
          end
472
481
          rv
473
482
        end
474
483
 
475
 
        def maker_target(maker)
476
 
          maker.items.new_item
 
484
        def maker_target(items)
 
485
          if items.respond_to?("items")
 
486
            # For backward compatibility
 
487
            items = items.items
 
488
          end
 
489
          items.new_item
477
490
        end
478
491
 
479
492
        def setup_maker_element(item)
496
509
 
497
510
          def initialize(url=nil, content=nil)
498
511
            super()
499
 
            @url = url
500
 
            @content = content
 
512
            self.url = url
 
513
            self.content = content
501
514
          end
502
515
 
503
516
          private
528
541
 
529
542
          [
530
543
            ["url", nil, true],
531
 
            ["length", nil, true],
 
544
            ["length", nil, true, :integer],
532
545
            ["type", nil, true],
533
 
          ].each do |name, uri, required|
534
 
            install_get_attribute(name, uri, required)
 
546
          ].each do |name, uri, required, type|
 
547
            install_get_attribute(name, uri, required, type)
535
548
          end
536
549
 
537
550
          def initialize(url=nil, length=nil, type=nil)
538
551
            super()
539
 
            @url = url
540
 
            @length = length
541
 
            @type = type
 
552
            self.url = url
 
553
            self.length = length
 
554
            self.type = type
542
555
          end
543
556
 
544
557
          def to_s(need_convert=true, indent=calc_indent)
581
594
 
582
595
          def initialize(domain=nil, content=nil)
583
596
            super()
584
 
            @domain = domain
585
 
            @content = content
 
597
            self.domain = domain
 
598
            self.content = content
586
599
          end
587
600
 
588
601
          private
614
627
          install_model(name, nil)
615
628
        end
616
629
 
 
630
        def initialize(title=nil, description=nil, name=nil, link=nil)
 
631
          super()
 
632
          self.title = title
 
633
          self.description = description
 
634
          self.name = name
 
635
          self.link = link
 
636
        end
 
637
 
617
638
        def to_s(need_convert=true, indent=calc_indent)
618
639
          rv = tag(indent) do |next_indent|
619
640
            [
631
652
        private
632
653
        def _tags
633
654
          %w(title description name link).each do |name|
634
 
            send(name).nil?
 
655
            __send__(name).nil?
635
656
          end.collect do |elem|
636
657
            [nil, elem]
637
658
          end