Class: PDoc::Generators::Pythonesque::Description
- Inherits:
-
Object
- Object
- PDoc::Generators::Pythonesque::Description
- Defined in:
- lib/pdoc/generators/pythonesque.rb
Constant Summary collapse
- JS_ESCAPE_MAP =
{ '\\' => '\\\\', '</' => '<\/', "\r\n" => '\n', "\n" => '\n', "\r" => '\n', '"' => '\\"', "'" => "\\'" }
Instance Attribute Summary collapse
-
#obj ⇒ Object
readonly
Returns the value of attribute obj.
Instance Method Summary collapse
-
#initialize(obj) ⇒ Description
constructor
A new instance of Description.
- #to_escaped_str ⇒ Object
- #to_str ⇒ Object
Constructor Details
#initialize(obj) ⇒ Description
Returns a new instance of Description.
49 50 51 |
# File 'lib/pdoc/generators/pythonesque.rb', line 49 def initialize(obj) @obj = obj end |
Instance Attribute Details
#obj ⇒ Object (readonly)
Returns the value of attribute obj.
48 49 50 |
# File 'lib/pdoc/generators/pythonesque.rb', line 48 def obj @obj end |
Instance Method Details
#to_escaped_str ⇒ Object
67 68 69 |
# File 'lib/pdoc/generators/pythonesque.rb', line 67 def to_escaped_str escape(to_str) end |
#to_str ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/pdoc/generators/pythonesque.rb', line 53 def to_str return "#{obj.full_name} has been deprecated." if obj.deprecated? results = [] results << sig results << args if obj.respond_to?(:arguments) && obj.arguments? results << desc results << aliases if obj.aliases? if obj.respond_to?(:constructor) && obj.constructor results << "\nWhen called as a constructor:\n" results << Description.new(obj.constructor).to_str end results.join("\n") end |