Module: Playbook::Truncate

Included in:
KitBase
Defined in:
lib/playbook/truncate.rb

Constant Summary collapse

TRUNCATE_VALUES =
%w[1 2 3 4 5].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
# File 'lib/playbook/truncate.rb', line 5

def self.included(base)
  base.prop :truncate
end

Instance Method Details

#truncate_optionsObject



18
19
20
# File 'lib/playbook/truncate.rb', line 18

def truncate_options
  { truncate: "truncate" }
end

#truncate_propsObject



11
12
13
14
15
16
# File 'lib/playbook/truncate.rb', line 11

def truncate_props
  value = truncate
  return nil unless value

  "truncate_#{value}" if TRUNCATE_VALUES.include?(value.to_s)
end

#truncate_valuesObject



22
23
24
# File 'lib/playbook/truncate.rb', line 22

def truncate_values
  TRUNCATE_VALUES
end