Class: RspecGenerateDoc::GenerateFIle
- Inherits:
-
Object
- Object
- RspecGenerateDoc::GenerateFIle
- Defined in:
- lib/rspec_generate_doc/generate_file.rb
Constant Summary collapse
- TEMPLATE_EXTNAME =
'erb'.freeze
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Class Method Summary collapse
Instance Method Summary collapse
- #create_file_by_template ⇒ Object
-
#initialize(data = {}) ⇒ GenerateFIle
constructor
A new instance of GenerateFIle.
Constructor Details
#initialize(data = {}) ⇒ GenerateFIle
Returns a new instance of GenerateFIle.
10 11 12 13 14 |
# File 'lib/rspec_generate_doc/generate_file.rb', line 10 def initialize(data = {}) @actions = data[:actions] @parent = data[:parent] I18n.locale = configuration.locale end |
Instance Attribute Details
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
8 9 10 |
# File 'lib/rspec_generate_doc/generate_file.rb', line 8 def actions @actions end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
8 9 10 |
# File 'lib/rspec_generate_doc/generate_file.rb', line 8 def parent @parent end |
Class Method Details
.source_root ⇒ Object
16 17 18 |
# File 'lib/rspec_generate_doc/generate_file.rb', line 16 def self.source_root configuration.docs_dir end |
Instance Method Details
#create_file_by_template ⇒ Object
20 21 22 23 24 25 |
# File 'lib/rspec_generate_doc/generate_file.rb', line 20 def create_file_by_template file = File.open(file_path, 'w+') file.write ERB.new(File.binread(configuration.template_file), nil, '-').result(binding).to_s .force_encoding('utf-8') file.close end |