Class: Pod::Generator::DummySource
- Inherits:
-
Object
- Object
- Pod::Generator::DummySource
- Defined in:
- lib/cocoapods/generator/dummy_source.rb
Instance Attribute Summary collapse
-
#class_name ⇒ Object
readonly
Returns the value of attribute class_name.
Instance Method Summary collapse
-
#initialize(class_name_identifier) ⇒ DummySource
constructor
A new instance of DummySource.
- #save_as(pathname) ⇒ Object
Constructor Details
#initialize(class_name_identifier) ⇒ DummySource
Returns a new instance of DummySource.
6 7 8 9 |
# File 'lib/cocoapods/generator/dummy_source.rb', line 6 def initialize(class_name_identifier) validated_class_name_identifier = class_name_identifier.gsub(/[^0-9a-z_]/i, '_') @class_name = "PodsDummy_#{validated_class_name_identifier}" end |
Instance Attribute Details
#class_name ⇒ Object (readonly)
Returns the value of attribute class_name.
4 5 6 |
# File 'lib/cocoapods/generator/dummy_source.rb', line 4 def class_name @class_name end |
Instance Method Details
#save_as(pathname) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/cocoapods/generator/dummy_source.rb', line 11 def save_as(pathname) pathname.open('w') do |source| source.puts '#import <Foundation/Foundation.h>' source.puts "@interface #{class_name} : NSObject" source.puts '@end' source.puts "@implementation #{class_name}" source.puts '@end' end end |