Skip to content

Instantly share code, notes, and snippets.

@ono-max
Last active October 3, 2022 14:03
Show Gist options
  • Save ono-max/50cc2e2732a48537049a0d4aa2649878 to your computer and use it in GitHub Desktop.
Save ono-max/50cc2e2732a48537049a0d4aa2649878 to your computer and use it in GitHub Desktop.
# pattern1
def to_rdbg_mimebundle kw
format = {
"application/rdbg+json" => json
}
format, {}
end
# pattern2
def to_rdbg_mimebundle kw
format = {
"application/rdbg+json" => json
},
metadata = {
"application/rdbg+json" => {
type: :table,
paginate: {
totalLen: ary.size
},
type: :lineChart,
xAxisKeys: x_keys,
yAxisKeys: y_keys
}
}
format, metadata
end
# pattern3
def to_rdbg_mimebundle kw
format = {
"application/rdbg+json" => data,
},
metadata = {
"application/rdbg+json" => {
:table => {
paginate: {
totalLen: ary.size
}
},
:lineChart => {
xAxisKeys: x_keys,
yAxisKeys: y_keys
}
}
}
format, metadata
end
# pattern4
def to_rdbg_mimebundle kw
format = {
"application/rdbg.table+json" => data,
"application/rdbg.barchart+json" => data,
"application/rdbg.linechart+json" => data
},
metadata = {
"application/rdbg.table+json" => {
paginate: {
totalLen: ary.size
}
},
"application/rdbg.linechart+json" => {
xAxisKeys: x_keys,
yAxisKeys: y_keys
}
}
format, metadata
end
# pattern5
def to_rdbg_mimebundle kw
format = {
"application/rdbg.table" => data,
"application/rdbg.barchart" => data,
"application/rdbg.linechart" => data
},
metadata = {
"application/rdbg.table" => {
paginate: {
totalLen: ary.size
}
},
"application/rdbg.linechart" => {
xAxisKeys: x_keys,
yAxisKeys: y_keys
}
}
format, metadata
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment