Class: Rpub::Preview
- Inherits:
-
Object
- Object
- Rpub::Preview
- Defined in:
- lib/rpub/preview.rb
Instance Attribute Summary (collapse)
-
- (Object) context
readonly
Returns the value of attribute context.
-
- (Object) source
readonly
Returns the value of attribute source.
Instance Method Summary (collapse)
-
- (Object) formatted
-
- (Preview) initialize(context, source)
constructor
A new instance of Preview.
-
- (Object) text
Constructor Details
- (Preview) initialize(context, source)
A new instance of Preview
5 6 7 |
# File 'lib/rpub/preview.rb', line 5 def initialize(context, source) @context, @source = context, source end |
Instance Attribute Details
- (Object) context (readonly)
Returns the value of attribute context
3 4 5 |
# File 'lib/rpub/preview.rb', line 3 def context @context end |
- (Object) source (readonly)
Returns the value of attribute source
3 4 5 |
# File 'lib/rpub/preview.rb', line 3 def source @source end |
Instance Method Details
- (Object) formatted
9 10 11 12 |
# File 'lib/rpub/preview.rb', line 9 def formatted return unless context.chapter_files.any? move_styles_inline(plain) end |
- (Object) text
14 15 16 |
# File 'lib/rpub/preview.rb', line 14 def text Nokogiri::HTML(plain).xpath('//text()').to_s end |