Class: Soybean::Generators::ModelSpecGenerator
- Inherits:
-
Object
- Object
- Soybean::Generators::ModelSpecGenerator
- Includes:
- BaseGenerator
- Defined in:
- lib/soybean/generators/model_spec_generator.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #actions ⇒ Object
- #class_name ⇒ Object
- #dir ⇒ Object
- #fullpath(basedir) ⇒ Object
- #generate ⇒ Object
-
#initialize(model, spec_dir) ⇒ ModelSpecGenerator
constructor
A new instance of ModelSpecGenerator.
- #interface_name ⇒ Object
Methods included from BaseGenerator
Constructor Details
#initialize(model, spec_dir) ⇒ ModelSpecGenerator
Returns a new instance of ModelSpecGenerator.
9 10 11 12 |
# File 'lib/soybean/generators/model_spec_generator.rb', line 9 def initialize(model, spec_dir) @model, @spec_dir = model, spec_dir @name = model.name + '_spec' end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/soybean/generators/model_spec_generator.rb', line 6 def name @name end |
Instance Method Details
#actions ⇒ Object
29 30 31 |
# File 'lib/soybean/generators/model_spec_generator.rb', line 29 def actions @actions ||= InterfaceBuilder.new(@model.wsdl, WSDL::SOAP::ClassNameCreator.new).actions end |
#class_name ⇒ Object
33 34 35 |
# File 'lib/soybean/generators/model_spec_generator.rb', line 33 def class_name @model.class_name end |
#dir ⇒ Object
18 19 20 |
# File 'lib/soybean/generators/model_spec_generator.rb', line 18 def dir @spec_dir end |
#fullpath(basedir) ⇒ Object
14 15 16 |
# File 'lib/soybean/generators/model_spec_generator.rb', line 14 def fullpath(basedir) File.join(dir, filename) end |
#generate ⇒ Object
22 23 24 25 26 27 |
# File 'lib/soybean/generators/model_spec_generator.rb', line 22 def generate source = File.("../templates/model_spec.rb", __FILE__) context = instance_eval('binding') content = ERB.new(::File.binread(source), nil, '-').result(context) content end |
#interface_name ⇒ Object
37 38 39 |
# File 'lib/soybean/generators/model_spec_generator.rb', line 37 def interface_name @model.interface_name end |