Sha256: dd018f65ec733c46244ec21bc3f044f2ebde1ad341dc3b92cf16c2ac33b0be83

Contents?: true

Size: 1.23 KB

Versions: 6

Compression:

Stored size: 1.23 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

6 entries across 6 versions & 1 rubygems

Version Path
ruby-net-nntp-0.0.3 lib/net/nntp_group.rb
ruby-net-nntp-0.0.7 lib/net/nntp_group.rb
ruby-net-nntp-0.0.4 lib/net/nntp_group.rb
ruby-net-nntp-0.0.2 lib/net/nntp_group.rb
ruby-net-nntp-0.0.6 lib/net/nntp_group.rb
ruby-net-nntp-0.0.5 lib/net/nntp_group.rb