Module: Safrano::EntityBase::Transitions

Includes:
Transitions::GetNextTrans::ByLongestMatchDyn
Included in:
Safrano::EntityBase
Defined in:
lib/odata/entity.rb

Overview

methods related to transitions to next state (cf. walker)

Instance Method Summary collapse

Methods included from Transitions::GetNextTrans::ByLongestMatchDyn

#get_next_transresult

Instance Method Details

#allowed_transitionsObject



18
19
20
# File 'lib/odata/entity.rb', line 18

def allowed_transitions
  self.class.entity_allowed_transitions
end

#transition_attribute(match_result) ⇒ Object



41
42
43
44
# File 'lib/odata/entity.rb', line 41

def transition_attribute(match_result)
  attrib = match_result[1]
  [Safrano::Attribute.new(self, attrib), :run]
end

#transition_count(_match_result) ⇒ Object



28
29
30
# File 'lib/odata/entity.rb', line 28

def transition_count(_match_result)
  [self, :end]
end

#transition_end(_match_result) ⇒ Object



24
25
26
# File 'lib/odata/entity.rb', line 24

def transition_end(_match_result)
  Safrano::Transition::RESULT_END
end

#transition_invalid_attribute(match_result) ⇒ Object



56
57
58
59
# File 'lib/odata/entity.rb', line 56

def transition_invalid_attribute(match_result)
  invalid_attrib = match_result[1]
  [nil, :error, Safrano::ErrorNotFoundSegment.new(invalid_attrib)]
end


37
38
39
# File 'lib/odata/entity.rb', line 37

def transition_links(_match_result)
  [self, :run_with_links]
end

#transition_nav_collection(match_result) ⇒ Object



46
47
48
49
# File 'lib/odata/entity.rb', line 46

def transition_nav_collection(match_result)
  attrib = match_result[1]
  [get_related(attrib), :run]
end

#transition_nav_entity(match_result) ⇒ Object



51
52
53
54
# File 'lib/odata/entity.rb', line 51

def transition_nav_entity(match_result)
  attrib = match_result[1]
  [get_related_entity(attrib), :run]
end

#transition_value(_match_result) ⇒ Object



32
33
34
35
# File 'lib/odata/entity.rb', line 32

def transition_value(_match_result)
  # $value is only allowd for media entities (or attributes)
  [self, :end_with_media_value]
end