Class: YahooStock::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/yahoo_stock/result.rb

Direct Known Subclasses

ArrayFormat, HashFormat, XmlFormat

Defined Under Namespace

Classes: ArrayFormat, HashFormat, XmlFormat

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ Result

Returns a new instance of Result


4
5
6
# File 'lib/yahoo_stock/result.rb', line 4

def initialize(context)
  @context = context
end

Instance Method Details

#outputObject


8
9
10
11
# File 'lib/yahoo_stock/result.rb', line 8

def output
  return @context if @context.is_a?(String)
  @context.output
end

#store(filename) ⇒ Object


13
14
15
16
17
18
# File 'lib/yahoo_stock/result.rb', line 13

def store(filename)
  File.open(filename, 'a') do |f|
    f.write(output)
    f.write("\n")
  end
end