Class: ConversionToPathname

Inherits:
UserChoices::Conversion
  • Object
show all
Defined in:
lib/aef/linebreak/pathname_conversion.rb

Overview

This class adds the type :pathname to user-choices

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.described_by?(conversion_tag) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/aef/linebreak/pathname_conversion.rb', line 20

def self.described_by?(conversion_tag)
  conversion_tag == :pathname
end

Instance Method Details

#convert(value) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/aef/linebreak/pathname_conversion.rb', line 32

def convert(value)
  case value
  when Array
    pathnames = []
    
    value.each {|path| pathnames << Pathname(path) }

    pathnames
  else
    Pathname(value)
  end
end

#descriptionObject



24
25
26
# File 'lib/aef/linebreak/pathname_conversion.rb', line 24

def description
  "a pathname"
end

#suitable?(actual) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/aef/linebreak/pathname_conversion.rb', line 28

def suitable?(actual)
  true
end