Module: RIO::Cx::Methods
- Included in:
- State::Base
- Defined in:
- lib/rio/filter.rb,
lib/rio/context/cxx.rb,
lib/rio/context/dir.rb,
lib/rio/context/gzip.rb,
lib/rio/context/skip.rb,
lib/rio/context/stream.rb,
lib/rio/context/copying.rb,
lib/rio/context/methods.rb,
lib/rio/context/methods.rb,
lib/rio/context/methods.rb,
lib/rio/context/methods.rb,
lib/rio/context/methods.rb,
lib/rio/context/methods.rb,
lib/rio/context/methods.rb,
lib/rio/context/autoclose.rb,
lib/rio/context/autoclose.rb,
lib/rio/context/autoclose.rb
Class Method Summary collapse
Instance Method Summary collapse
- #+@ ⇒ Object
- #_arg_skip(args) ⇒ Object
- #_noarg_skip ⇒ Object
- #a ⇒ Object
- #a! ⇒ Object
- #all(arg = true, &block) ⇒ Object
- #all? ⇒ Boolean
- #bytes(nb = 1, *args, &block) ⇒ Object
- #bytes_(nb = 1, *args, &block) ⇒ Object
- #closeoncopy(arg = true, &block) ⇒ Object
- #closeoncopy? ⇒ Boolean
- #closeoneof(arg = true, &block) ⇒ Object
- #closeoneof? ⇒ Boolean
- #copying(dest) ⇒ Object
- #copying? ⇒ Boolean
- #copying_done(dest) ⇒ Object
- #copying_from ⇒ Object
- #copying_from? ⇒ Boolean
- #copying_from_done ⇒ Object
- #copying_to ⇒ Object
- #copying_to? ⇒ Boolean
- #copying_to_done ⇒ Object
- #dir_iter? ⇒ Boolean
- #dirs(*args, &block) ⇒ Object
- #entries(*args, &block) ⇒ Object
- #ext(arg = nil) ⇒ Object
- #ext? ⇒ Boolean
- #files(*args, &block) ⇒ Object
- #gzip(arg = true, &block) ⇒ Object
- #gzip? ⇒ Boolean
- #inputmode? ⇒ Boolean
- #line(*args, &block) ⇒ Object
- #line_(*args, &block) ⇒ Object
- #lines(*args, &block) ⇒ Object
- #lines_(*args, &block) ⇒ Object
- #mode(arg) ⇒ Object
- #mode? ⇒ Boolean
- #noall(arg = false, &block) ⇒ Object
- #noautoclose(arg = false, &block) ⇒ Object
- #nocloseoncopy(arg = false, &block) ⇒ Object
- #nocloseoneof(arg = false, &block) ⇒ Object
- #noext ⇒ Object
- #norecurse(*args, &block) ⇒ Object
- #nostreamenum(arg = true, &block) ⇒ Object
- #nostreamenum? ⇒ Boolean
- #nosync(arg = false, &block) ⇒ Object
- #outputmode? ⇒ Boolean
- #r ⇒ Object
- #r! ⇒ Object
- #record(*args, &block) ⇒ Object
- #record_(*args, &block) ⇒ Object
- #records(*args, &block) ⇒ Object
- #records_(*args, &block) ⇒ Object
- #recurse(*args, &block) ⇒ Object
- #row(*args, &block) ⇒ Object
- #row_(*args, &block) ⇒ Object
- #rows(*args, &block) ⇒ Object
- #rows_(*args, &block) ⇒ Object
- #skip(*args, &block) ⇒ Object
- #skipdirs(*args, &block) ⇒ Object
- #skipentries(*args, &block) ⇒ Object
- #skipfiles(*args, &block) ⇒ Object
- #skiplines(*args, &block) ⇒ Object
- #skipping? ⇒ Boolean
- #skiprecords(*args, &block) ⇒ Object
- #skiprecords_(*args, &block) ⇒ Object
- #skiprows(*args, &block) ⇒ Object
- #split(*args, &block) ⇒ Object
- #stream_iter? ⇒ Boolean
- #sync(arg = true, &block) ⇒ Object
- #sync? ⇒ Boolean
- #w ⇒ Object
- #w! ⇒ Object
Class Method Details
.make_filter_methods(sym) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/rio/filter.rb', line 58 def self.make_filter_methods(sym) module_eval %{ def #{sym}(arg=true,&block) cx['#{sym}'] = arg add_filter(Filter::#{sym.to_s.capitalize}) if arg and self.ioh each(&block) if block_given? self end def #{sym}?() cxx?('#{sym}') end def no#{sym}(arg=false,&block) #{sym}(arg,&block) end } end |
Instance Method Details
#+@ ⇒ Object
179 |
# File 'lib/rio/context/methods.rb', line 179 def +@() a() end |
#_arg_skip(args) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/rio/context/skip.rb', line 42 def _arg_skip(args) #p callstr('_arg_skip',args,cx.inspect) cx['ss_skipped'] = cx['ss_type'].sub(/^skip/,'') if cx['ss_type'] cx['ss_type'] = 'skip' cx['skip_args'] = args end |
#_noarg_skip ⇒ Object
48 49 50 51 52 |
# File 'lib/rio/context/skip.rb', line 48 def _noarg_skip cx['ss_skipped'] = cx['ss_type'].sub(/^skip/,'') if cx['ss_type'] cx['ss_type'] = 'skip' cx['skipping'] = true end |
#a ⇒ Object
171 |
# File 'lib/rio/context/methods.rb', line 171 def a() cx['outputmode'] = Mode::Str.new('a'); self end |
#a! ⇒ Object
172 |
# File 'lib/rio/context/methods.rb', line 172 def a!() cx['outputmode'] = Mode::Str.new('a+'); self end |
#all(arg = true, &block) ⇒ Object
122 |
# File 'lib/rio/context/methods.rb', line 122 def all(arg=true,&block) cxx('all',arg,&block) end |
#all? ⇒ Boolean
124 |
# File 'lib/rio/context/methods.rb', line 124 def all?() cxx?('all') end |
#bytes(nb = 1, *args, &block) ⇒ Object
209 210 211 212 213 214 215 216 |
# File 'lib/rio/context/stream.rb', line 209 def bytes(nb=1,*args,&block) _set_sstype('bytes') _set_bytes(nb) _set_itertype('records') _set_rectype('bytes') each(&block) if block_given? self end |
#bytes_(nb = 1, *args, &block) ⇒ Object
217 218 219 220 221 222 223 |
# File 'lib/rio/context/stream.rb', line 217 def bytes_(nb=1,*args,&block) _set_bytes_(nb) _set_itertype('records',false) _set_rectype('bytes',false) each(&block) if block_given? self end |
#closeoncopy(arg = true, &block) ⇒ Object
52 |
# File 'lib/rio/context/autoclose.rb', line 52 def closeoncopy(arg=true,&block) cxx('closeoncopy',arg,&block) end |
#closeoncopy? ⇒ Boolean
54 |
# File 'lib/rio/context/autoclose.rb', line 54 def closeoncopy?() cxx?('closeoncopy') end |
#closeoneof(arg = true, &block) ⇒ Object
42 |
# File 'lib/rio/context/autoclose.rb', line 42 def closeoneof(arg=true,&block) cxx('closeoneof',arg,&block) end |
#closeoneof? ⇒ Boolean
44 |
# File 'lib/rio/context/autoclose.rb', line 44 def closeoneof?() cxx?('closeoneof') end |
#copying(dest) ⇒ Object
49 |
# File 'lib/rio/context/copying.rb', line 49 def (dest) dest.; end |
#copying? ⇒ Boolean
50 |
# File 'lib/rio/context/copying.rb', line 50 def () or end |
#copying_done(dest) ⇒ Object
51 |
# File 'lib/rio/context/copying.rb', line 51 def (dest) dest.; end |
#copying_from ⇒ Object
45 |
# File 'lib/rio/context/copying.rb', line 45 def () cx['copying_from'] = true; self end |
#copying_from? ⇒ Boolean
46 |
# File 'lib/rio/context/copying.rb', line 46 def () cx['copying_from'] end |
#copying_from_done ⇒ Object
47 |
# File 'lib/rio/context/copying.rb', line 47 def () cx.delete('copying_from'); self end |
#copying_to ⇒ Object
41 |
# File 'lib/rio/context/copying.rb', line 41 def () cx['copying_to'] = true; self end |
#copying_to? ⇒ Boolean
42 |
# File 'lib/rio/context/copying.rb', line 42 def () cx['copying_to'] end |
#copying_to_done ⇒ Object
43 |
# File 'lib/rio/context/copying.rb', line 43 def () cx.delete('copying_to'); self end |
#dir_iter? ⇒ Boolean
44 |
# File 'lib/rio/context/dir.rb', line 44 def dir_iter?() cx.has_key?('entry_sel') end |
#dirs(*args, &block) ⇒ Object
81 82 83 |
# File 'lib/rio/context/dir.rb', line 81 def dirs(*args,&block) _set_select(_selkey('dirs'),*args,&block) end |
#entries(*args, &block) ⇒ Object
75 76 77 |
# File 'lib/rio/context/dir.rb', line 75 def entries(*args,&block) _set_select(_selkey('entries'),*args,&block) end |
#ext(arg = nil) ⇒ Object
146 147 148 149 150 |
# File 'lib/rio/context/methods.rb', line 146 def ext(arg=nil) arg ||= self.extname || "" self.cx['ext'] = arg self end |
#ext? ⇒ Boolean
155 156 157 158 |
# File 'lib/rio/context/methods.rb', line 155 def ext?() self.cx.set_('ext',self.extname || "") if self.cx['ext'].nil? self.cx['ext'] end |
#files(*args, &block) ⇒ Object
78 79 80 |
# File 'lib/rio/context/dir.rb', line 78 def files(*args,&block) _set_select(_selkey('files'),*args,&block) end |
#gzip(arg = true, &block) ⇒ Object
42 43 44 45 46 |
# File 'lib/rio/context/gzip.rb', line 42 def gzip(arg=true,&block) self.cx['gzip'] = arg; each(&block) if block_given? self end |
#gzip? ⇒ Boolean
47 |
# File 'lib/rio/context/gzip.rb', line 47 def gzip?() cxx?('gzip') end |
#inputmode? ⇒ Boolean
178 |
# File 'lib/rio/context/methods.rb', line 178 def inputmode?() cxx?('inputmode') end |
#line(*args, &block) ⇒ Object
123 124 125 126 127 |
# File 'lib/rio/context/stream.rb', line 123 def line(*args,&block) #p callstr('line',*args) cx['line'] = true self.lines(*args,&block) end |
#line_(*args, &block) ⇒ Object
128 129 130 131 132 |
# File 'lib/rio/context/stream.rb', line 128 def line_(*args,&block) #p callstr('line_',*args) cx.set_('line',true) self.lines_(*args,&block) end |
#lines(*args, &block) ⇒ Object
107 108 109 110 111 112 113 114 115 116 |
# File 'lib/rio/context/stream.rb', line 107 def lines(*args,&block) #p callstr('lines',*args) if skipping? cx['skipping'] = false skiplines(*args,&block) else _set_sstype('lines') _lines(args,_sel,&block) end end |
#lines_(*args, &block) ⇒ Object
117 118 119 120 121 |
# File 'lib/rio/context/stream.rb', line 117 def lines_(*args,&block) #p callstr('lines_',*args) _set_sstype('lines',false) _lines(args,_sel,false,&block) end |
#mode(arg) ⇒ Object
61 62 63 64 65 |
# File 'lib/rio/context/methods.rb', line 61 def mode(arg) # p callstr('mode',arg) self.cx['mode'] = Mode::Str.new(arg) self end |
#mode? ⇒ Boolean
66 67 68 |
# File 'lib/rio/context/methods.rb', line 66 def mode?() self.cx['mode'] end |
#noall(arg = false, &block) ⇒ Object
123 |
# File 'lib/rio/context/methods.rb', line 123 def noall(arg=false,&block) nocxx('all',arg,&block) end |
#noautoclose(arg = false, &block) ⇒ Object
62 63 64 |
# File 'lib/rio/context/autoclose.rb', line 62 def noautoclose(arg=false,&block) closeoncopy(arg).closeoneof(arg,&block) end |
#nocloseoncopy(arg = false, &block) ⇒ Object
53 |
# File 'lib/rio/context/autoclose.rb', line 53 def nocloseoncopy(arg=false,&block) nocxx('closeoncopy',arg,&block) end |
#nocloseoneof(arg = false, &block) ⇒ Object
43 |
# File 'lib/rio/context/autoclose.rb', line 43 def nocloseoneof(arg=false,&block) nocxx('closeoneof',arg,&block) end |
#noext ⇒ Object
151 152 153 154 |
# File 'lib/rio/context/methods.rb', line 151 def noext() ext('') self end |
#norecurse(*args, &block) ⇒ Object
111 112 113 114 115 |
# File 'lib/rio/context/dir.rb', line 111 def norecurse(*args,&block) _addselkey('r_nosel',:dir?,*args).all_ return each(&block) if block_given? self end |
#nostreamenum(arg = true, &block) ⇒ Object
135 |
# File 'lib/rio/context/methods.rb', line 135 def (arg=true,&block) cxx('nostreamenum',arg,&block) end |
#nostreamenum? ⇒ Boolean
136 |
# File 'lib/rio/context/methods.rb', line 136 def () cxx?('nostreamenum') end |
#nosync(arg = false, &block) ⇒ Object
98 99 100 101 |
# File 'lib/rio/context/methods.rb', line 98 def nosync(arg=false,&block) ioh.sync = arg unless ioh.nil? nocxx('sync',arg,&block) end |
#outputmode? ⇒ Boolean
177 |
# File 'lib/rio/context/methods.rb', line 177 def outputmode?() cxx?('outputmode') end |
#r ⇒ Object
175 |
# File 'lib/rio/context/methods.rb', line 175 def r() cx['inputmode'] = Mode::Str.new('r'); self end |
#r! ⇒ Object
176 |
# File 'lib/rio/context/methods.rb', line 176 def r!() cx['inputmode'] = Mode::Str.new('r+'); self end |
#record(*args, &block) ⇒ Object
148 149 150 151 152 |
# File 'lib/rio/context/stream.rb', line 148 def record(*args,&block) #p callstr('record',*args) cx['record'] = true self.records(*args,&block) end |
#record_(*args, &block) ⇒ Object
153 154 155 156 157 |
# File 'lib/rio/context/stream.rb', line 153 def record_(*args,&block) #p callstr('record_',*args) cx.set_('record',true) self.records_(*args,&block) end |
#records(*args, &block) ⇒ Object
134 135 136 137 138 139 140 141 142 |
# File 'lib/rio/context/stream.rb', line 134 def records(*args,&block) if skipping? cx['skipping'] = false skiprecords(*args,&block) else _set_sstype('records') _records(args,_sel,&block) end end |
#records_(*args, &block) ⇒ Object
143 144 145 146 |
# File 'lib/rio/context/stream.rb', line 143 def records_(*args,&block) _set_sstype('records',false) _records(args,_sel,false,&block) end |
#recurse(*args, &block) ⇒ Object
106 107 108 109 110 |
# File 'lib/rio/context/dir.rb', line 106 def recurse(*args,&block) _addselkey('r_sel',:dir?,*args).all_ return each(&block) if block_given? self end |
#row(*args, &block) ⇒ Object
173 174 175 176 177 |
# File 'lib/rio/context/stream.rb', line 173 def row(*args,&block) #p callstr('row',*args) cx['row'] = true self.rows(*args,&block) end |
#row_(*args, &block) ⇒ Object
178 179 180 181 182 |
# File 'lib/rio/context/stream.rb', line 178 def row_(*args,&block) #p callstr('row_',*args) cx.set_('row',true) self.rows_(*args,&block) end |
#rows(*args, &block) ⇒ Object
159 160 161 162 163 164 165 166 167 |
# File 'lib/rio/context/stream.rb', line 159 def rows(*args,&block) if skipping? cx['skipping'] = false skiprows(*args,&block) else _set_sstype('rows') _rows(args,_sel,&block) end end |
#rows_(*args, &block) ⇒ Object
168 169 170 171 |
# File 'lib/rio/context/stream.rb', line 168 def rows_(*args,&block) _set_sstype('rows',false) _rows(args,_sel,false,&block) end |
#skip(*args, &block) ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/rio/context/skip.rb', line 54 def skip(*args,&block) if args.empty? _noarg_skip else _arg_skip(args) end each(&block) if block_given? self end |
#skipdirs(*args, &block) ⇒ Object
91 92 93 |
# File 'lib/rio/context/dir.rb', line 91 def skipdirs(*args,&block) _set_select('skipdirs',*args,&block) end |
#skipentries(*args, &block) ⇒ Object
85 86 87 |
# File 'lib/rio/context/dir.rb', line 85 def skipentries(*args,&block) _set_select('skipentries',*args,&block) end |
#skipfiles(*args, &block) ⇒ Object
88 89 90 |
# File 'lib/rio/context/dir.rb', line 88 def skipfiles(*args,&block) _set_select('skipfiles',*args,&block) end |
#skiplines(*args, &block) ⇒ Object
185 186 187 188 189 190 |
# File 'lib/rio/context/stream.rb', line 185 def skiplines(*args,&block) #p callstr('skiplines',*args) self.lines() unless args.empty? or cx.has_key?('stream_sel') _set_sstype('skiplines') _lines(args,false,&block) end |
#skipping? ⇒ Boolean
53 |
# File 'lib/rio/context/skip.rb', line 53 def skipping?() cx['skipping'] end |
#skiprecords(*args, &block) ⇒ Object
191 192 193 194 195 |
# File 'lib/rio/context/stream.rb', line 191 def skiprecords(*args,&block) self.records_() unless args.empty? or cx.has_key?('stream_sel') _set_sstype('skiprecords') _records(args,false,&block) end |
#skiprecords_(*args, &block) ⇒ Object
196 197 198 199 200 |
# File 'lib/rio/context/stream.rb', line 196 def skiprecords_(*args,&block) self.records_() unless args.empty? or cx.has_key?('stream_sel') _set_sstype('skiprecords',false) _records(args,false,false,&block) end |
#skiprows(*args, &block) ⇒ Object
201 202 203 204 205 |
# File 'lib/rio/context/stream.rb', line 201 def skiprows(*args,&block) self.rows() unless args.empty? or cx.has_key?('stream_sel') _set_sstype('skiprows') _rows(args,false,&block) end |
#split(*args, &block) ⇒ Object
81 82 83 84 85 86 87 |
# File 'lib/rio/context/methods.rb', line 81 def split(*args,&block) if args.empty? self.splitpath else self.splitlines(*args,&block) end end |
#stream_iter? ⇒ Boolean
43 |
# File 'lib/rio/context/stream.rb', line 43 def stream_iter?() cx.has_key?('stream_itertype') && !cx['nostreamenum'] end |
#sync(arg = true, &block) ⇒ Object
94 95 96 97 |
# File 'lib/rio/context/methods.rb', line 94 def sync(arg=true,&block) ioh.sync = arg unless ioh.nil? cxx('sync',arg,&block) end |
#sync? ⇒ Boolean
102 103 104 105 106 107 108 109 |
# File 'lib/rio/context/methods.rb', line 102 def sync?() setting = cxx?('sync') unless ioh.nil? actual = ioh.sync cxx_(actual) unless actual == setting end setting end |
#w ⇒ Object
173 |
# File 'lib/rio/context/methods.rb', line 173 def w() cx['outputmode'] = Mode::Str.new('w'); self end |
#w! ⇒ Object
174 |
# File 'lib/rio/context/methods.rb', line 174 def w!() cx['outputmode'] = Mode::Str.new('w+'); self end |