Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/slither/column.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def initialize(name, length, options = {})
@type = options[:type] || :string
@padding = options[:padding] || :space
@truncate = options[:truncate] || false
@default = options[:default]
# Only used with floats, this determines the decimal places
@precision = options[:precision]
end
Expand Down Expand Up @@ -93,6 +94,7 @@ def inspect
end

def to_s(value)
value = @default if value.nil? && !@default.nil?
result = case @type
when :date
# If it's a DBI::Timestamp object, see if we can convert it to a Time object
Expand Down Expand Up @@ -144,3 +146,4 @@ def validate_size(result)
end
end
end

4 changes: 2 additions & 2 deletions lib/slither/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def generate(data)
end
end

builder.join("\n")
builder.join(definition.options[:new_line] || "\n")
end

private
Expand All @@ -43,4 +43,4 @@ def raise_required_section_empty(section)
)
end
end
end
end