class Rsstsvop::Rsstsvop
Attributes
content[R]
content_array[R]
fname[R]
passwd[R]
url[R]
user[R]
Public Class Methods
new( hash )
click to toggle source
# File lib/rsstsvop/rsstsvop.rb, line 8 def initialize( hash ) @url = hash["url"] @user = hash["user"] @passwd = hash["passwd"] @fname = hash["fname"] end
Public Instance Methods
get()
click to toggle source
# File lib/rsstsvop/rsstsvop.rb, line 19 def get if @user != nil and @passwd != nil @content = open(@url, http_basic_authentication: [@user, @passwd]).read else @content = open(@url).read end self end
load_yaml( pn )
click to toggle source
# File lib/rsstsvop/rsstsvop.rb, line 15 def load_yaml( pn ) YAML.load_file( pn ) end
read_from_file()
click to toggle source
# File lib/rsstsvop/rsstsvop.rb, line 38 def read_from_file File.open( @fname , 'r' , {encoding: Encoding::UTF_8} ){|f| @content = f.read } self end
read_from_file_to_array()
click to toggle source
# File lib/rsstsvop/rsstsvop.rb, line 45 def read_from_file_to_array @content_array = [] File.open( @fname , 'r' , {encoding: 'BOM|UTF-8'} ){|f| while l = f.gets @content_array << l.chomp! end } self end
save()
click to toggle source
# File lib/rsstsvop/rsstsvop.rb, line 29 def save # puts "== save" File.open( @fname , 'w' , {encoding: Encoding::UTF_8} ){|f| f.write( @content ) } self end