Class: Rubiks::Mondrian::Member
- Inherits:
-
Object
- Object
- Rubiks::Mondrian::Member
- Defined in:
- lib/rubiks/mondrian/member.rb
Instance Attribute Summary collapse
-
#raw_member ⇒ Object
readonly
Returns the value of attribute raw_member.
Instance Method Summary collapse
- #all_member? ⇒ Boolean
- #calculated? ⇒ Boolean
- #calculated_in_query? ⇒ Boolean
- #caption ⇒ Object
- #children ⇒ Object
- #depth ⇒ Object
- #descendants_at_level(level) ⇒ Object
- #dimension_type ⇒ Object
- #drillable? ⇒ Boolean
- #full_name ⇒ Object
-
#initialize(raw_member) ⇒ Member
constructor
A new instance of Member.
- #name ⇒ Object
- #property_formatted_value(name) ⇒ Object
- #property_value(name) ⇒ Object
- #visible? ⇒ Boolean
Constructor Details
#initialize(raw_member) ⇒ Member
Returns a new instance of Member.
9 10 11 |
# File 'lib/rubiks/mondrian/member.rb', line 9 def initialize(raw_member) @raw_member = raw_member end |
Instance Attribute Details
#raw_member ⇒ Object (readonly)
Returns the value of attribute raw_member.
13 14 15 |
# File 'lib/rubiks/mondrian/member.rb', line 13 def raw_member @raw_member end |
Instance Method Details
#all_member? ⇒ Boolean
39 40 41 |
# File 'lib/rubiks/mondrian/member.rb', line 39 def all_member? @raw_member.isAll end |
#calculated? ⇒ Boolean
27 28 29 |
# File 'lib/rubiks/mondrian/member.rb', line 27 def calculated? @raw_member.isCalculated end |
#calculated_in_query? ⇒ Boolean
31 32 33 |
# File 'lib/rubiks/mondrian/member.rb', line 31 def calculated_in_query? @raw_member.isCalculatedInQuery end |
#caption ⇒ Object
23 24 25 |
# File 'lib/rubiks/mondrian/member.rb', line 23 def @raw_member.getCaption end |
#children ⇒ Object
67 68 69 70 71 |
# File 'lib/rubiks/mondrian/member.rb', line 67 def children ::Rubiks::MondrianError.wrap_native_exception do @raw_member.getChildMembers.map{|m| ::Rubiks::Mondrian::Member.new(m)} end end |
#depth ⇒ Object
52 53 54 |
# File 'lib/rubiks/mondrian/member.rb', line 52 def depth @raw_member.getDepth end |
#descendants_at_level(level) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/rubiks/mondrian/member.rb', line 73 def descendants_at_level(level) ::Rubiks::MondrianError.wrap_native_exception do raw_level = @raw_member.getLevel raw_levels = raw_level.getHierarchy.getLevels current_level_index = raw_levels.indexOf(raw_level) descendants_level_index = raw_levels.indexOfName(level) return nil unless descendants_level_index > current_level_index members = [self] (descendants_level_index - current_level_index).times do members = members.map do |member| member.children end.flatten end members end end |
#dimension_type ⇒ Object
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/rubiks/mondrian/member.rb', line 56 def dimension_type case @raw_member.getDimension.getDimensionType when Java::OrgOlap4jMetadata::Dimension::Type::TIME :time when Java::OrgOlap4jMetadata::Dimension::Type::MEASURE :measures else :standard end end |
#drillable? ⇒ Boolean
43 44 45 46 47 48 49 50 |
# File 'lib/rubiks/mondrian/member.rb', line 43 def drillable? return false if calculated? # @raw_member.getChildMemberCount > 0 # This hopefully is faster than counting actual child members raw_level = @raw_member.getLevel raw_levels = raw_level.getHierarchy.getLevels raw_levels.indexOf(raw_level) < raw_levels.size - 1 end |
#full_name ⇒ Object
19 20 21 |
# File 'lib/rubiks/mondrian/member.rb', line 19 def full_name @raw_member.getUniqueName end |
#name ⇒ Object
15 16 17 |
# File 'lib/rubiks/mondrian/member.rb', line 15 def name @raw_member.getName end |
#property_formatted_value(name) ⇒ Object
98 99 100 101 102 |
# File 'lib/rubiks/mondrian/member.rb', line 98 def property_formatted_value(name) if property = @raw_member.getProperties.get(name) @raw_member.getPropertyFormattedValue(property) end end |
#property_value(name) ⇒ Object
92 93 94 95 96 |
# File 'lib/rubiks/mondrian/member.rb', line 92 def property_value(name) if property = @raw_member.getProperties.get(name) @raw_member.getPropertyValue(property) end end |
#visible? ⇒ Boolean
35 36 37 |
# File 'lib/rubiks/mondrian/member.rb', line 35 def visible? @raw_member.isVisible end |