Class: ZendeskAppsSupport::AppFile
- Inherits:
-
Object
- Object
- ZendeskAppsSupport::AppFile
- Defined in:
- lib/zendesk_apps_support/app_file.rb
Instance Attribute Summary collapse
-
#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.
- #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.
7 8 9 10 |
# File 'lib/zendesk_apps_support/app_file.rb', line 7 def initialize(package, relative_path) @relative_path = relative_path @file = File.new(package.root.join(relative_path)) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/zendesk_apps_support/app_file.rb', line 22 def method_missing(sym, *args, &block) if @file.respond_to?(sym) @file.call(sym, *args, &block) else super end end |
Instance Attribute Details
#relative_path ⇒ Object (readonly) Also known as: to_s
Returns the value of attribute relative_path.
5 6 7 |
# File 'lib/zendesk_apps_support/app_file.rb', line 5 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 |
#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
31 32 33 |
# File 'lib/zendesk_apps_support/app_file.rb', line 31 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
36 37 38 |
# File 'lib/zendesk_apps_support/app_file.rb', line 36 def respond_to_missing?(sym, include_private = false) @file.respond_to_missing?(sym, include_private) || super end |