Module: Alf::Viewpoint::ClassMethods

Included in:
Alf::Viewpoint
Defined in:
lib/alf/viewpoint.rb

Instance Method Summary collapse

Instance Method Details

#build(context = {}) ⇒ Object Also known as: []


19
20
21
22
# File 'lib/alf/viewpoint.rb', line 19

def build(context = {})
  x = self
  .to_module(context){ include(x) }
end

#depends(as, *viewpoints) ⇒ Object


15
16
17
# File 'lib/alf/viewpoint.rb', line 15

def depends(as, *viewpoints)
  .depends(as => viewpoints)
end

#expects(*viewpoints) ⇒ Object


11
12
13
# File 'lib/alf/viewpoint.rb', line 11

def expects(*viewpoints)
  .expects(viewpoints)
end

#membersObject


39
40
41
# File 'lib/alf/viewpoint.rb', line 39

def members
  .all_members
end

#metadataObject


7
8
9
# File 'lib/alf/viewpoint.rb', line 7

def 
  @metadata ||= Metadata.new
end

#method_added(m) ⇒ Object


43
44
45
46
47
48
49
# File 'lib/alf/viewpoint.rb', line 43

def method_added(m)
  res = super
  if public_method_defined?(m) && (m.to_s != 'contextual_params')
    .add_members([m])
  end
  res
end

#native(as, native_name = as) ⇒ Object


33
34
35
36
37
# File 'lib/alf/viewpoint.rb', line 33

def native(as, native_name = as)
  define_method(as) do
    Algebra.named_operand(native_name, connection)
  end
end

#parse(*args, &bl) ⇒ Object


29
30
31
# File 'lib/alf/viewpoint.rb', line 29

def parse(*args, &bl)
  parser.parse(*args, &bl)
end

#parser(connection = nil) ⇒ Object


25
26
27
# File 'lib/alf/viewpoint.rb', line 25

def parser(connection = nil)
  Lang::Parser::Lispy.new([ self ], connection)
end