Class: JIJI::BaseOut
Overview
出力先の基底クラス
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
補足情報.
-
#time ⇒ Object
現在時刻.
Instance Method Summary collapse
-
#each(scale = :raw, start_date = nil, end_date = nil, &block) ⇒ Object
データを読み込む.
-
#initialize(dir, name, options) ⇒ BaseOut
constructor
コンストラクタ.
-
#save ⇒ Object
設定値をファイルに出力.
-
#set_properties(props) ⇒ Object
- プロパティを設定する。 props
-
プロパティ.
Constructor Details
#initialize(dir, name, options) ⇒ BaseOut
コンストラクタ
100 101 102 103 104 |
# File 'lib/jiji/output.rb', line 100 def initialize( dir, name, ) @dir = dir @dao = JIJI::Dao::TimedDataDao.new( dir, aggregators ) @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
補足情報
130 131 132 |
# File 'lib/jiji/output.rb', line 130 def @options end |
#time ⇒ Object
現在時刻
132 133 134 |
# File 'lib/jiji/output.rb', line 132 def time @time end |
Instance Method Details
#each(scale = :raw, start_date = nil, end_date = nil, &block) ⇒ Object
データを読み込む
107 108 109 110 111 |
# File 'lib/jiji/output.rb', line 107 def each( scale=:raw, start_date=nil, end_date=nil, &block ) @dao.each_data( scale, start_date, end_date ) { |row, time| yield row } end |
#save ⇒ Object
設定値をファイルに出力
123 124 125 126 127 |
# File 'lib/jiji/output.rb', line 123 def save FileLock.new("#{@dir}/meta.yaml" ).writelock { |f| f.write( YAML.dump(@options) ) } end |
#set_properties(props) ⇒ Object
プロパティを設定する。
- props
-
プロパティ
115 116 117 118 119 120 |
# File 'lib/jiji/output.rb', line 115 def set_properties( props ) props.each_pair {|k,v| @options[k.to_sym] = v } save end |