Created
October 1, 2010 12:23
-
-
Save kbrock/606127 to your computer and use it in GitHub Desktop.
Hirb example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> Disease.find(2) | |
=> #<Disease id: 2, name: "MS", symptom_survey_lifespan: 30, disease_status_id: 3, key: "ms", community_manager_id: 3187, created_at: nil, updated_at: nil> | |
>> User.first | |
# => #<User id: 22, verified: true, deleted: false, created_at: "2008-07-03 13:36:57", updated_at: "2010-09-23 03:18:13", first_name: "Justin", last_name: "Smith", title: "wife", disease_id: 2, address: nil, city: "Boston", state: "MA", country: "United States", sex: nil, birth_date: nil, deceased_date: nil, permit_registry: nil, height: nil, display_height_unit: nil, display_weight_unit: nil, allows_public_view: false, lat: #<BigDecimal:1098c57d0,'0.28228671E2',18(18)>, lng: #<BigDecimal:1098c56e0,'-0.81653075E2',18(18)>, postcode: "02142", last_activity_time: "2008-07-03 13:38:10", last_update_time: nil, allows_badge: false, timezone: nil, phone: nil, messaging_privileges: nil, role_id: 5, unsubscribe_token: "21a497dae68b11780871083eddd6a3f201389bd6", welcome_message_sent_on: "2009-03-24", system_welcome_message_sent_on: "2009-03-24", birth_date_precision: nil, parent_or_guardian: nil, has_basic_info: false, race_id: nil, education_level_id: nil, ethnicity_id: nil, health_insurance_type_id: nil, suspended_reason_id: nil, deleted_at: nil, account_id: 111, announcement_dismissed_on: nil, region: 7, login: "user22", last_update_type: nil> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
true and begin # Colorize results | |
require 'rubygems' | |
require 'wirble' | |
Wirble.init | |
Wirble.colorize | |
rescue | |
end | |
true and begin #format results | |
require 'hirb' | |
Hirb::View.enable | |
rescue | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> Disease.find(2) | |
+----+------+-------------------------+-------------------+-----+----------------------+------------+------------+ | |
| id | name | symptom_survey_lifespan | disease_status_id | key | community_manager_id | created_at | updated_at | | |
+----+------+-------------------------+-------------------+-----+----------------------+------------+------------+ | |
| 2 | MS | 30 | 3 | ms | 3187 | | | | |
+----+------+-------------------------+-------------------+-----+----------------------+------------+------------+ | |
1 row in set | |
>> User.first | |
********************************************* 1. row ********************************************* | |
id: 22 | |
verified: true | |
deleted: false | |
created_at: Thu Jul 03 13:36:57 -0400 2008 | |
updated_at: Thu Sep 23 03:18:13 -0400 2010 | |
first_name: Justin | |
last_name: Smith | |
title: wife | |
disease_id: 2 | |
address: | |
city: Boston | |
state: MA | |
country: United States | |
sex: | |
birth_date: | |
deceased_date: | |
permit_registry: | |
height: | |
display_height_unit: | |
display_weight_unit: | |
allows_public_view: false | |
lat: 28.228671 | |
lng: -81.653075 | |
postcode: 02142 | |
last_activity_time: Thu Jul 03 13:38:10 -0400 2008 | |
last_update_time: | |
allows_badge: false | |
timezone: | |
phone: | |
messaging_privileges: | |
role_id: 5 | |
unsubscribe_token: 21xxx | |
welcome_message_sent_on: 2009-03-24 | |
system_welcome_message_sent_on: 2009-03-24 | |
birth_date_precision: | |
parent_or_guardian: | |
has_basic_info: false | |
race_id: | |
education_level_id: | |
ethnicity_id: | |
health_insurance_type_id: | |
suspended_reason_id: | |
deleted_at: | |
account_id: 22 | |
announcement_dismissed_on: | |
region: 7 | |
login: user22 | |
last_update_type: | |
1 row in set |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:output: | |
User: | |
:options: | |
:fields: | |
- id | |
- login | |
- first_name | |
- last_name | |
- title | |
- disease_id | |
- city | |
- state | |
- role_id | |
- created_at |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> Disease.find(2) | |
+----+------+-------------------------+-------------------+-----+----------------------+------------+------------+ | |
| id | name | symptom_survey_lifespan | disease_status_id | key | community_manager_id | created_at | updated_at | | |
+----+------+-------------------------+-------------------+-----+----------------------+------------+------------+ | |
| 2 | MS | 30 | 3 | ms | 3187 | | | | |
+----+------+-------------------------+-------------------+-----+----------------------+------------+------------+ | |
1 row in set | |
>> User.first | |
+------+---------+------------+-----------+-------+------------+----------+-------+---------+--------------------------------+ | |
| id | login | first_name | last_name | title | disease_id | city | state | role_id | created_at | | |
+------+---------+------------+-----------+-------+------------+----------+-------+---------+--------------------------------+ | |
| 22 | user22 | Justin | Smith | wife | 2 | Boston | MA | 5 | Thu Jul 03 13:36:57 -0400 2008 | | |
+------+---------+------------+-----------+-------+------------+----------+-------+---------+--------------------------------+ | |
1 row in set |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:output: | |
User: | |
:options: | |
:fields: | |
- id | |
- login | |
- first_name | |
- last_name | |
- title | |
# can call methods | |
- disease_name | |
- city | |
- state | |
- role_id | |
- created_at | |
:headers: | |
disease_name: disease | |
role_id: role | |
#find out how to enable for all objects | |
:filters: | |
created_at: | |
- to_s | |
- :short |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> Disease.find(2) | |
+----+------+-------------------------+-------------------+-----+----------------------+------------+------------+ | |
| id | name | symptom_survey_lifespan | disease_status_id | key | community_manager_id | created_at | updated_at | | |
+----+------+-------------------------+-------------------+-----+----------------------+------------+------------+ | |
| 2 | MS | 30 | 3 | ms | 3187 | | | | |
+----+------+-------------------------+-------------------+-----+----------------------+------------+------------+ | |
1 row in set | |
>> User.first | |
+------+---------+------------+-----------+-------+---------+----------+-------+------+--------------+ | |
| id | login | first_name | last_name | title | disease | city | state | role | created_at | | |
+------+---------+------------+-----------+-------+---------+----------+-------+------+--------------+ | |
| 22 | user22 | Justin | Smith | wife | MS | Boston | MA | 5 | 03 Jul 13:36 | | |
+------+---------+------------+-----------+-------+---------+----------+-------+------+--------------+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment