Class: RemoteTable::File
- Inherits:
-
Object
- Object
- RemoteTable::File
- Defined in:
- lib/remote_table/file.rb
Instance Attribute Summary collapse
-
#crop ⇒ Object
Returns the value of attribute crop.
-
#cut ⇒ Object
Returns the value of attribute cut.
-
#delimiter ⇒ Object
Returns the value of attribute delimiter.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#format ⇒ Object
Returns the value of attribute format.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#path ⇒ Object
Returns the value of attribute path.
-
#schema ⇒ Object
Returns the value of attribute schema.
-
#schema_name ⇒ Object
Returns the value of attribute schema_name.
-
#sheet ⇒ Object
Returns the value of attribute sheet.
-
#skip ⇒ Object
Returns the value of attribute skip.
-
#trap ⇒ Object
Returns the value of attribute trap.
Instance Method Summary collapse
-
#initialize(bus) ⇒ File
constructor
A new instance of File.
- #tabulate(path) ⇒ Object
Constructor Details
#initialize(bus) ⇒ File
Returns a new instance of File.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/remote_table/file.rb', line 6 def initialize(bus) @filename = bus[:filename] @format = bus[:format] || format_from_filename @delimiter = bus[:delimiter] @sheet = bus[:sheet] || 0 @skip = bus[:skip] # rows @crop = bus[:crop] # rows @cut = bus[:cut] # columns @headers = bus[:headers] @schema = bus[:schema] @schema_name = bus[:schema_name] @trap = bus[:trap] extend "RemoteTable::#{format.to_s.camelcase}".constantize end |
Instance Attribute Details
#crop ⇒ Object
Returns the value of attribute crop.
3 4 5 |
# File 'lib/remote_table/file.rb', line 3 def crop @crop end |
#cut ⇒ Object
Returns the value of attribute cut.
3 4 5 |
# File 'lib/remote_table/file.rb', line 3 def cut @cut end |
#delimiter ⇒ Object
Returns the value of attribute delimiter.
3 4 5 |
# File 'lib/remote_table/file.rb', line 3 def delimiter @delimiter end |
#filename ⇒ Object
Returns the value of attribute filename.
3 4 5 |
# File 'lib/remote_table/file.rb', line 3 def filename @filename end |
#format ⇒ Object
Returns the value of attribute format.
3 4 5 |
# File 'lib/remote_table/file.rb', line 3 def format @format end |
#headers ⇒ Object
Returns the value of attribute headers.
3 4 5 |
# File 'lib/remote_table/file.rb', line 3 def headers @headers end |
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/remote_table/file.rb', line 4 def path @path end |
#schema ⇒ Object
Returns the value of attribute schema.
3 4 5 |
# File 'lib/remote_table/file.rb', line 3 def schema @schema end |
#schema_name ⇒ Object
Returns the value of attribute schema_name.
3 4 5 |
# File 'lib/remote_table/file.rb', line 3 def schema_name @schema_name end |
#sheet ⇒ Object
Returns the value of attribute sheet.
3 4 5 |
# File 'lib/remote_table/file.rb', line 3 def sheet @sheet end |
#skip ⇒ Object
Returns the value of attribute skip.
3 4 5 |
# File 'lib/remote_table/file.rb', line 3 def skip @skip end |
#trap ⇒ Object
Returns the value of attribute trap.
3 4 5 |
# File 'lib/remote_table/file.rb', line 3 def trap @trap end |
Instance Method Details
#tabulate(path) ⇒ Object
21 22 23 24 25 |
# File 'lib/remote_table/file.rb', line 21 def tabulate(path) define_fixed_width_schema! if format == :fixed_width and schema.is_a?(Array) # TODO move to generic subclass callback self.path = path self end |