Sha256: 4f79432115284b5b39020068d4798dd64c3f2e8f8ae31397093fec4908c5dc71

Contents?: true

Size: 1.43 KB

Versions: 2

Compression:

Stored size: 1.43 KB

Contents

module Net

  class NNTP

    class Group
      attr_reader :name, :article_count, :article_first, :article_last
      attr_reader :hi, :lo, :postingmode

      def initialize(name)
        @name = name
        @articles ||= Articles.new(self)
        #@articles.group = self
        @article_first = @article_last = @article_count = nil
      end

      def article_info=(art_array)
        @article_count = art_array[0].to_i
        @article_first = art_array[1].to_i
        @article_last = art_array[2].to_i
      end

      def articles
        @articles
      end

      def articles=(articles)
        @articles = articles
      end

      def listinfo(hi, lo, postingmode)
        @hi = hi
        @lo = lo
        @postingmode = postingmode
      end

      def inspect
"Group: #{@name}  #{@article_count} #{@article_first} #{@article_last}"
      end

      class Articles

        attr_accessor :group

        def initialize(group)
          @articles ||=[]
        end

        def build_from_over(over, format)
          article = Article.new
          article.overview_format = format
          article.overview(over)
          @articles << article
        end

        def length
          @articles.length
        end

        def <<(article)
          @articles << article
        end

        def create
          a = Article.new
          a.group = self.group
          @articles << a
          a
        end

      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-net-nntp-0.0.8 lib/net/nntp_group.rb
ruby-net-nntp-0.0.9 lib/net/nntp_group.rb