Module: GreenHat::ThingHelpers
- Included in:
- Thing
- Defined in:
- lib/greenhat/thing/helpers.rb
Overview
Accessors / Readers
Instance Method Summary collapse
-
#build_path(divider = '_') ⇒ Object
Format the name of this thing.
-
#inspect ⇒ Object
Console Helper.
-
#type_check ⇒ Object
Check what kind of file we have.
Instance Method Details
#build_path(divider = '_') ⇒ Object
Format the name of this thing
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/greenhat/thing/helpers.rb', line 16 def build_path(divider = '_') tmp_path = file.gsub("#{archive.path}/", '') case tmp_path.count('/') when 0 tmp_path when 1 tmp_path.split('/').last else tmp_path.split('/').last(2).join(divider) end end |
#inspect ⇒ Object
Console Helper
6 7 8 9 10 11 12 13 |
# File 'lib/greenhat/thing/helpers.rb', line 6 def inspect [ 'Thing'.pastel(:bright_black), kind&.to_s&.pastel(:blue), type&.pastel(:bright_yellow), name&.pastel(:cyan) ].compact.join(' ') end |