Navigation Menu

Skip to content

Commit

Permalink
Add Response::ColumnList::Column#full_name
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Oct 30, 2017
1 parent f071877 commit 681d691
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/groonga/client/response/column-list.rb
Expand Up @@ -64,6 +64,14 @@ class Column < Struct.new(:id,
:domain,
:range,
:source)
# @return [String]
# The column name with table name such as `TABLE.COLUMN`.
#
# @since 0.5.4
def full_name
"#{domain}.#{name}"
end

# @return [::Array<String>]
# The flag names of the column.
#
Expand Down
24 changes: 24 additions & 0 deletions test/response/test-column-list.rb
Expand Up @@ -93,6 +93,30 @@ def create_response(columns)
Groonga::Client::Response::ColumnList.new(@command, header, body)
end

class TestFullName < self
def create_response(domain, name)
columns = [
[
256,
name,
"/tmp/test.db.0000100",
"var",
"COLUMN_SCALAR|PERSISTENT",
domain,
"ShortText",
[],
]
]
super(columns)
end

def test_full_name
response = create_response("Memos", "content")
assert_equal("Memos.content",
response[0].full_name)
end
end

class TestFlags < self
def create_response(flags)
columns = [
Expand Down

0 comments on commit 681d691

Please sign in to comment.