Class: Itinerary::View
- Inherits:
-
Object
- Object
- Itinerary::View
- Defined in:
- lib/itinerary/view.rb,
lib/itinerary/views/kml.rb,
lib/itinerary/views/tab.rb,
lib/itinerary/views/html.rb,
lib/itinerary/views/text.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#hide_fields ⇒ Object
Returns the value of attribute hide_fields.
-
#name ⇒ Object
Returns the value of attribute name.
-
#show_fields ⇒ Object
Returns the value of attribute show_fields.
Instance Method Summary collapse
-
#initialize(itinerary, params = {}) ⇒ View
constructor
A new instance of View.
- #render(entries) ⇒ Object
Constructor Details
#initialize(itinerary, params = {}) ⇒ View
Returns a new instance of View.
8 9 10 11 12 13 14 |
# File 'lib/itinerary/view.rb', line 8 def initialize(itinerary, params={}) @itinerary = itinerary @show_fields = Record.field_keys @hide_fields = [] @output = StringIO.new params.each { |k, v| method("#{k}=").call(v) } end |
Instance Attribute Details
#hide_fields ⇒ Object
Returns the value of attribute hide_fields.
6 7 8 |
# File 'lib/itinerary/view.rb', line 6 def hide_fields @hide_fields end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/itinerary/view.rb', line 4 def name @name end |
#show_fields ⇒ Object
Returns the value of attribute show_fields.
5 6 7 |
# File 'lib/itinerary/view.rb', line 5 def show_fields @show_fields end |
Instance Method Details
#render(entries) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/itinerary/view.rb', line 16 def render(entries) @field_keys = @show_fields - @hide_fields entries.each do |rec| render_record(rec) end @output.rewind @output.read end |