Class: FixedWidthColumns::Config

Inherits:
Aduki::Initializable
  • Object
show all
Defined in:
lib/fixed_width_columns/config.rb

Constant Summary collapse

@@export_configs =
{ }

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#labelObject

Returns the value of attribute label.



5
6
7
# File 'lib/fixed_width_columns/config.rb', line 5

def label
  @label
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/fixed_width_columns/config.rb', line 5

def name
  @name
end

#targetObject

Returns the value of attribute target.



5
6
7
# File 'lib/fixed_width_columns/config.rb', line 5

def target
  @target
end

Instance Method Details

#headers?(header) ⇒ Boolean

Returns:

  • (Boolean)


14
# File 'lib/fixed_width_columns/config.rb', line 14

def headers?                    header ; header ? [formatter.headers] : []                                ; end

#pre_process(items) ⇒ Object



15
# File 'lib/fixed_width_columns/config.rb', line 15

def pre_process                  items ; (preprocessors || []).inject(items) { |list, pp| pp.apply list } ; end

#to_text(items, header = nil) ⇒ Object



9
10
11
# File 'lib/fixed_width_columns/config.rb', line 9

def to_text items, header=nil
  pre_process(items).inject(headers? header) { |ll, i| ll << formatter.format(i) }.join "\n"
end