Class: ParameterSubstitution::Formatters::Left

Inherits:
Base
  • Object
show all
Defined in:
lib/parameter_substitution/formatters/left.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

encoding, format, key, parse_duration

Constructor Details

#initialize(character_count) ⇒ Left

Returns a new instance of Left.



12
13
14
# File 'lib/parameter_substitution/formatters/left.rb', line 12

def initialize(character_count)
  @character_count = character_count
end

Class Method Details

.descriptionObject



4
5
6
# File 'lib/parameter_substitution/formatters/left.rb', line 4

def self.description
  "Takes a single n argument. Returns the left most n characters from the input."
end

.has_parameters?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/parameter_substitution/formatters/left.rb', line 8

def self.has_parameters?
  true
end

Instance Method Details

#format(value) ⇒ Object



16
17
18
# File 'lib/parameter_substitution/formatters/left.rb', line 16

def format(value)
  value.to_s[0, @character_count]
end