Class: Rusic::ThemeFile
- Inherits:
-
Object
- Object
- Rusic::ThemeFile
- Defined in:
- lib/rusic/theme_file.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
- #descriptor ⇒ Object
- #directory ⇒ Object
- #dirname ⇒ Object
- #extname ⇒ Object
- #filename ⇒ Object
-
#initialize(file) ⇒ ThemeFile
constructor
A new instance of ThemeFile.
- #pathname ⇒ Object
- #relative_path ⇒ Object
- #root_name ⇒ Object
- #uploader ⇒ Object
- #working_directory ⇒ Object
Constructor Details
#initialize(file) ⇒ ThemeFile
Returns a new instance of ThemeFile.
7 8 9 |
# File 'lib/rusic/theme_file.rb', line 7 def initialize(file) @file = file end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
5 6 7 |
# File 'lib/rusic/theme_file.rb', line 5 def file @file end |
Instance Method Details
#descriptor ⇒ Object
32 33 34 |
# File 'lib/rusic/theme_file.rb', line 32 def descriptor "#{dirname}/#{filename}" end |
#directory ⇒ Object
40 41 42 |
# File 'lib/rusic/theme_file.rb', line 40 def directory relative_path.to_s.chomp(filename.to_s) end |
#dirname ⇒ Object
52 53 54 |
# File 'lib/rusic/theme_file.rb', line 52 def dirname pathname.dirname end |
#extname ⇒ Object
60 61 62 |
# File 'lib/rusic/theme_file.rb', line 60 def extname pathname.extname end |
#filename ⇒ Object
56 57 58 |
# File 'lib/rusic/theme_file.rb', line 56 def filename pathname.basename end |
#pathname ⇒ Object
64 65 66 |
# File 'lib/rusic/theme_file.rb', line 64 def pathname Pathname.new(file) end |
#relative_path ⇒ Object
44 45 46 |
# File 'lib/rusic/theme_file.rb', line 44 def relative_path pathname.relative_path_from(working_directory) end |
#root_name ⇒ Object
36 37 38 |
# File 'lib/rusic/theme_file.rb', line 36 def root_name relative_path.each_filename.first end |
#uploader ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rusic/theme_file.rb', line 11 def uploader case root_name when 'layouts', 'ideas', 'pages', 'participant', 'snippets', 'mailers', 'reports' uploader = Uploaders::Template.new(self, relative_path) when 'assets' case extname when '.css', '.js' uploader = Uploaders::EditableAsset.new(self) else uploader = Uploaders::Asset.new(self) end else case filename.to_s when /attributes\.ya?ml/ uploader = Uploaders::CustomAttributes.new(self) end end uploader end |
#working_directory ⇒ Object
48 49 50 |
# File 'lib/rusic/theme_file.rb', line 48 def working_directory Pathname.new(Dir.pwd) end |