Class: I18n::Index::Format::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n/index/format.rb

Direct Known Subclasses

Stdout

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io = nil) ⇒ Base

Returns a new instance of Base.



11
12
13
# File 'lib/i18n/index/format.rb', line 11

def initialize(io = nil)
  self.io = io || $stdout
end

Instance Attribute Details

#ioObject

Returns the value of attribute io.



9
10
11
# File 'lib/i18n/index/format.rb', line 9

def io
  @io
end

Instance Method Details

#out(str) ⇒ Object



15
16
17
# File 'lib/i18n/index/format.rb', line 15

def out(str)
  io.print(str)
end

#setup(target) ⇒ Object



19
20
21
22
23
# File 'lib/i18n/index/format.rb', line 19

def setup(target)
  $stdout.sync = true
  (class << target; self; end).send(:include, self.class::Hooks)
  target.format = self
end