Class: ZendeskAppsSupport::AppFile
- Inherits:
-
Object
- Object
- ZendeskAppsSupport::AppFile
- Defined in:
- lib/zendesk_apps_support/app_file.rb
Instance Attribute Summary collapse
-
#absolute_path ⇒ Object
readonly
Returns the value of attribute absolute_path.
-
#relative_path ⇒ Object
(also: #to_s)
readonly
Returns the value of attribute relative_path.
Instance Method Summary collapse
- #=~(regex) ⇒ Object
-
#initialize(package, relative_path) ⇒ AppFile
constructor
A new instance of AppFile.
- #match(regex) ⇒ Object
- #method_missing(sym, *args, &block) ⇒ Object
- #read ⇒ Object
-
#respond_to?(sym, include_private = false) ⇒ Boolean
Unless Ruby 1.9.
-
#respond_to_missing?(sym, include_private = false) ⇒ Boolean
If Ruby 1.9.
Constructor Details
#initialize(package, relative_path) ⇒ AppFile
Returns a new instance of AppFile.
6 7 8 9 10 |
# File 'lib/zendesk_apps_support/app_file.rb', line 6 def initialize(package, relative_path) @relative_path = relative_path @file = File.new(package.root.join(relative_path)) @absolute_path = File.absolute_path @file.path end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/zendesk_apps_support/app_file.rb', line 26 def method_missing(sym, *args, &block) if @file.respond_to?(sym) @file.call(sym, *args, &block) else super end end |
Instance Attribute Details
#absolute_path ⇒ Object (readonly)
Returns the value of attribute absolute_path.
4 5 6 |
# File 'lib/zendesk_apps_support/app_file.rb', line 4 def absolute_path @absolute_path end |
#relative_path ⇒ Object (readonly) Also known as: to_s
Returns the value of attribute relative_path.
3 4 5 |
# File 'lib/zendesk_apps_support/app_file.rb', line 3 def relative_path @relative_path end |
Instance Method Details
#=~(regex) ⇒ Object
16 17 18 |
# File 'lib/zendesk_apps_support/app_file.rb', line 16 def =~(regex) relative_path =~ regex end |
#match(regex) ⇒ Object
20 21 22 |
# File 'lib/zendesk_apps_support/app_file.rb', line 20 def match(regex) self =~ regex end |
#read ⇒ Object
12 13 14 |
# File 'lib/zendesk_apps_support/app_file.rb', line 12 def read File.read @file.path end |
#respond_to?(sym, include_private = false) ⇒ Boolean
Unless Ruby 1.9
35 36 37 |
# File 'lib/zendesk_apps_support/app_file.rb', line 35 def respond_to?(sym, include_private = false) @file.respond_to?(sym, include_private) || super end |
#respond_to_missing?(sym, include_private = false) ⇒ Boolean
If Ruby 1.9
40 41 42 |
# File 'lib/zendesk_apps_support/app_file.rb', line 40 def respond_to_missing?(sym, include_private = false) @file.send(:respond_to_missing?, sym, include_private) || super end |