Class: RspecGenerateDoc::GenarateFIle
- Inherits:
-
Object
- Object
- RspecGenerateDoc::GenarateFIle
- 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 = {}) ⇒ GenarateFIle
constructor
A new instance of GenarateFIle.
Constructor Details
#initialize(data = {}) ⇒ GenarateFIle
Returns a new instance of GenarateFIle.
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 |
# 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) file.close end |